Skip to content

An extension of UIDevice class to detect the device simply and fast.

License

Notifications You must be signed in to change notification settings

Rufy86/UIDeviceDetector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

UIDeviceDetector

An extension of UIDevice class to detect the device simply and fast.

Swift 4.2

Identifiable Devices

  • Air Pods
  • All iPhone (2018 updated)
  • All iPad (2018 updated)
  • All Apple Watch (2018 updated)
  • All Apple TV (2018 updated)
  • All iPods
  • Car Play

How to Use

To Check The Type of Device

This method check only if a device is an iPhone or an iPad regardless of the model

if UIDevice.current.deviceType?.isPhone {
    print("It's an iPhone")
}

if UIDevice.current.deviceType?.isIPad {
    print("It's an iPad")
}

To Detect The Type of Device

switch UIDevice.current.deviceType!{
    case .iPhone35:
        print("It's an 3,5 inch iPhone")
    case .iPhone40:
        print("It's an 4 inch iPhone")
}

To Detect The Model of Device

switch UIDevice.current.deviceModel! {
case .appleWatch:
    print("It's 1st gen Apple Watch")
case .appleTV4K:
    print("It's Apple TV 4K")
}

About

An extension of UIDevice class to detect the device simply and fast.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published