Skip to content

sudo-cuong/ResolutionChecker

Repository files navigation

Apple Devices Resolutions Checker

Build Status Version License Platform Carthage compatible

Easy to detect iOS device or version in your code

Features

Requirements

  • iOS 9.0+
  • Xcode 9
  • Swift 4

Installation

ResolutionChecker can be installed in various ways.

Cocoapods

pod 'ResolutionChecker'

Carthage

github "jack3010/ResolutionChecker" ~> 0.1.0

Manually

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

Check screen orientation

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

Detect device type

Device resolution checker helps you detect what kind of device is running app.

Device.type.rawValue

Output: iPhone

Detect device version

You also want to detect exact version like iPhone6, iPhone6 Plus,..etc. Type the command:

Device.version.rawValue

Check iPhone/iPad/Simulator

Device.isIphone
Device.isPad
Device.isPadPro10_5
Device.isPadPro12_9
Device.isSimulator
Device.isPhoneX

Detect iOS version

String(describing: Device.iosVersion)

Moreover, you also compare device screen.

if Screen.screen_3_5_inch < Screen.screen_4_0_inch {
   print("true")
}

TO DO NEXT

  • Compare version iOS.

Contributing

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.

About

A simple code to detect iOS device or version in your code

Resources

Stars

Watchers

Forks

Packages

No packages published