Skip to content

Instantly share code, notes, and snippets.

@r-dent
Last active July 9, 2016 12:06
Show Gist options
  • Save r-dent/6956c825bc1f1e57460c to your computer and use it in GitHub Desktop.
Save r-dent/6956c825bc1f1e57460c to your computer and use it in GitHub Desktop.
iOS Constants Swift
let IS_iOS_7 = UIDevice.currentDevice().systemVersion.hasPrefix("7")
let IS_iOS_8 = UIDevice.currentDevice().systemVersion.hasPrefix("8")
let IS_iPad = UI_USER_INTERFACE_IDIOM() == .Pad
let IS_IPHONE = UI_USER_INTERFACE_IDIOM() == .Phone
let IS_IPHONE_4S_AND_LOWER (IS_IPHONE && max(UIScreen.mainScreen().bounds.size.height, UIScreen.mainScreen().bounds.size.width) == 480.0)
let IS_IPHONE_5 = (IS_IPHONE && max(UIScreen.mainScreen().bounds.size.height, UIScreen.mainScreen().bounds.size.width) == 568.0)
let IS_iPhone6 = (IS_IPHONE && max(UIScreen.mainScreen().bounds.size.height, UIScreen.mainScreen().bounds.size.width) == 667)
let IS_iPhone6Plus = (IS_IPHONE && max(UIScreen.mainScreen().bounds.size.height, UIScreen.mainScreen().bounds.size.width) == 736)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment