Skip to content

Instantly share code, notes, and snippets.

@samuelbeek
Created October 8, 2015 10:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samuelbeek/043865c30802ff672eb8 to your computer and use it in GitHub Desktop.
Save samuelbeek/043865c30802ff672eb8 to your computer and use it in GitHub Desktop.
detect iOS devices
// example if(Devices.iPhone4) { view.alpha = 0 }
struct Devices {
static let iPhone4 = UIScreen.mainScreen().bounds.size.height == 480.0
static let iPhone5 = UIScreen.mainScreen().bounds.size.height == 568.0
static let iPhone6 = UIScreen.mainScreen().bounds.size.height == 667.0
static let iPhone6plus = UIScreen.mainScreen().bounds.size.height == 736.0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment