Home > Mobile >  iOS SwiftUI - get the height of top safe area
iOS SwiftUI - get the height of top safe area

Time:07-30

I tried this:

let window = UIApplication.shared.windows.first

print("safeareatop: \(window?.safeAreaInsets.top)")

and get:

'windows' was deprecated in iOS 15.0: Use UIWindowScene.windows on a relevant window scene instead

so I tried:

UIWindowScene.windows.first

but I get another error, the error messages from xcode are absolutely useless compared to android studios btw

the "solutions" from here:

demo

  • Related