In Objective-C we can get device width and height by using following code :
CGRect sizeRect = [UIScreen mainScreen].applicationFrame
float width = sizeRect.
(Swift 3) Keep in mind that most width and height values will be based on device's current orientation. If you want a consistent value that is not based on rotation and offers results as if you were in a portrait-up rotation, give fixedCoordinateSpace a try:
let screenSize = UIScreen.main.fixedCoordinateSpace.bounds