iOS Get Screen sizes for iPhone/iPad
About
A custom class to identify screensize of various devices.
Overview
- Easy customization
- Swift 5.0 above
- Xcode 11 above
- Orientation support
- Manual drag & drop the class
- iPhone/iPad support
ScreenSizes
Workflow
- Import
UIScreen+ScreenSize.swift
into you project - If you need to design specifically for iPhoneX series use the below code.
- For other uses like if you need to redesign for iPhoneSE & similar smaller devices, you can go with
switch
cases.
switch UIScreen.screenSizeType() {
case .inch4(.portrait),.inch4(.landscape):
print("iPhoneSE")
case .inch4_7:
print("iPhone8")
default:
break
}
Output
Reference: iPhoneResolutions
Download the file here
License
UIScreen+ScreenSize is distributed under the MIT license .
Let's grow together 🌱
Cheers 🍻