An extension of UIDevice class to detect the device simply and fast.
- Air Pods
- All iPhone (2018 updated)
- All iPad (2018 updated)
- All Apple Watch (2018 updated)
- All Apple TV (2018 updated)
- All iPods
- Car Play
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")
}
switch UIDevice.current.deviceType!{
case .iPhone35:
print("It's an 3,5 inch iPhone")
case .iPhone40:
print("It's an 4 inch iPhone")
}
switch UIDevice.current.deviceModel! {
case .appleWatch:
print("It's 1st gen Apple Watch")
case .appleTV4K:
print("It's Apple TV 4K")
}