How can I get the status bar's height programmatically in Swift?
In Objective-C, it's like this:
[UIApplication sharedApplication].statusBarFrame.size.height.
How can I get the status bar's height programmatically in Swift?
In Objective-C, it's like this:
[UIApplication sharedApplication].statusBarFrame.size.height.
Is there any problems with Swift 2.x:
Swift 3 or Swift 4:
Make sure
UIKit
is importedThis is what I use:
Then you can do:
Its just like in Objective-C:
This is included as a standard variable in:
https://github.com/goktugyil/EZSwiftExtensions
Swift is just a different language. The API elements are the same. Perhaps something like this: