How to get the status bar height in iOS 13?

Solution 1:

As the warning hints, you can access the statusBarManager which has a statusBarFrame property. This is defined on your UIWindow's windowScene.

let height = view.window?.windowScene?.statusBarManager?.statusBarFrame.height ?? 0

Solution 2:

Try, I have tried it.

let window = UIApplication.shared.windows.filter {$0.isKeyWindow}.first        
let height = window?.windowScene?.statusBarManager?.statusBarFrame.height ?? 0