How to detect device model by macro? i had using something like this but the result on the simulator alway IS_IPHONE_5
#define IS_IPAD (UI_USER_INTERFACE_IDI
public extension UIDevice {
var iPhone: Bool {
return UIDevice().userInterfaceIdiom == .Phone
}
enum ScreenType: String {
case iPhone4
case iPhone5
case iPhone6
case iPhone6Plus
case Unknown
}
var screenType: ScreenType {
guard iPhone else { return .Unknown}
switch UIScreen.mainScreen().nativeBounds.height {
case 960:
return .iPhone4
case 1136:
return .iPhone5
case 1334:
return .iPhone6
case 1920: //fallthrough
return .iPhone6Plus
case 2208:
return .iPhone6Plus
default:
return .Unknown
}
}
}