if UIDeviceOrientationIsLandscape(UIDevice.currentDevice().orientation) { print(\"landscape\") } if UIDeviceOrientationIsPortrait(UIDevice.currentDev
This works on Swift 3 & 4
switch UIApplication.shared.statusBarOrientation { case .portrait: //do something break case .portraitUpsideDown: //do something break case .landscapeLeft: //do something break case .landscapeRight: //do something break case .unknown: //default break }