Skip to content

Instantly share code, notes, and snippets.

@clintonmedbery
Created October 2, 2018 23:37
Show Gist options
  • Save clintonmedbery/8e32095d921152da026b283b9deb27a9 to your computer and use it in GitHub Desktop.
Save clintonmedbery/8e32095d921152da026b283b9deb27a9 to your computer and use it in GitHub Desktop.
Determine iPhone
if UIDevice().userInterfaceIdiom == .phone {
switch UIScreen.main.nativeBounds.height {
case 1136:
print("iPhone 5 or 5S or 5C")
case 1334:
print("iPhone 6/6S/7/8")
case 1920, 2208:
print("iPhone 6+/6S+/7+/8+")
case 2436:
print("iPhone X, Xs")
case 2688:
print("iPhone Xs Max")
case 1792:
print("iPhone Xr")
default:
print("unknown")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment