Created
October 2, 2018 23:37
-
-
Save clintonmedbery/8e32095d921152da026b283b9deb27a9 to your computer and use it in GitHub Desktop.
Determine iPhone
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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