Easy to detect iOS device or version in your code
- Check screen orientation
- Detect device type
- Detect device version
- Check iPhone/iPad/Simulator
- Detect iOS version
- iOS 9.0+
- Xcode 9
- Swift 4
ResolutionChecker can be installed in various ways.
pod 'ResolutionChecker'
github "jack3010/ResolutionChecker" ~> 0.1.0
To install manually drag and drop ResolutionChecker into your project in Xcode or add it as a submodule.In your project folder enter:
$ git submodule add https://github.com/jack3010/ResolutionChecker.git
If you want to check status of device when the device rotate. You can type a command:
override func viewDidLoad() {
super.viewDidLoad()
// Check status of screen orientation
print(String(Device.isLandscape))
}
The command Device.isLandscape
will return Bool
value
Device resolution checker helps you detect what kind of device is running app.
Device.type.rawValue
Output: iPhone
You also want to detect exact version like iPhone6, iPhone6 Plus,..etc. Type the command:
Device.version.rawValue
Device.isIphone
Device.isPad
Device.isPadPro10_5
Device.isPadPro12_9
Device.isSimulator
Device.isPhoneX
String(describing: Device.iosVersion)
Moreover, you also compare device screen.
if Screen.screen_3_5_inch < Screen.screen_4_0_inch {
print("true")
}
- Compare version iOS.
If you have the need for a specific feature that you want implemented or if you experienced a bug, please open an issue. If you extended the functionality of ResolutionChecker
yourself and want others to use it too, please submit a pull request.