Skip to content

Instantly share code, notes, and snippets.

@amirrajan
Created April 17, 2018 15:35
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 amirrajan/8b136a83c93f1d46b2b0c4c2b85094ce to your computer and use it in GitHub Desktop.
Save amirrajan/8b136a83c93f1d46b2b0c4c2b85094ce to your computer and use it in GitHub Desktop.
module ScreenSizes
def iPhone4?
UIScreen.mainScreen.bounds.size.height < 568
end
def iPhone5?
UIScreen.mainScreen.bounds.size.height == 568
end
def iPhone6Plus?
UIScreen.mainScreen.bounds.size.height == 736
end
def iPhone6?
UIScreen.mainScreen.bounds.size.height == 667
end
def iPad?
UIScreen.mainScreen.bounds.size.height == 1024
end
def iPhoneX?
UIScreen.mainScreen.bounds.size.height == 812
end
def device_screen_width
UIScreen.mainScreen.bounds.size.width
end
def device_screen_height
UIScreen.mainScreen.bounds.size.height
end
def screen_rect
CGRectMake(0, 0, device_screen_width, device_screen_height)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment