From 16383c54475680199a2105a51fbbfe9a0eb708e7 Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Thu, 28 Feb 2019 07:16:07 +0100 Subject: [PATCH 01/41] Add boolean and array functions to check if the device has a sensor housing. --- Source/Device.generated.swift | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Source/Device.generated.swift b/Source/Device.generated.swift index e1d30e8d..83a17418 100644 --- a/Source/Device.generated.swift +++ b/Source/Device.generated.swift @@ -623,6 +623,11 @@ public enum Device { public static var allFaceIDCapableDevices: [Device] { return [.iPhoneX, .iPhoneXs, .iPhoneXsMax, .iPhoneXr, .iPadPro11Inch, .iPadPro12Inch3] } + + /// All devices that feature a sensor housing in the screen + public static var allDevicesWithASensorHousing: [Device] { + return [.iPhoneX, .iPhoneXs, .iPhoneXsMax, .iPhoneXr] + } /// Returns whether or not the device has Touch ID public var isTouchIDCapable: Bool { @@ -633,6 +638,11 @@ public enum Device { public var isFaceIDCapable: Bool { return isOneOf(Device.allFaceIDCapableDevices) } + + /// Returns whether or not the device has a sensor housing + public var hasSensorHousing: Bool { + return isOneOf(Device.allDevicesWithASensorHousing) + } /// Returns whether or not the device has any biometric sensor (i.e. Touch ID or Face ID) public var hasBiometricSensor: Bool { From 6bd741019b9d342b27dbfa312490b7fd17318f2d Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Sun, 3 Mar 2019 20:25:11 +0100 Subject: [PATCH 02/41] Move variables together. --- Source/Device.generated.swift | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Source/Device.generated.swift b/Source/Device.generated.swift index 83a17418..0c26e8f7 100644 --- a/Source/Device.generated.swift +++ b/Source/Device.generated.swift @@ -623,11 +623,6 @@ public enum Device { public static var allFaceIDCapableDevices: [Device] { return [.iPhoneX, .iPhoneXs, .iPhoneXsMax, .iPhoneXr, .iPadPro11Inch, .iPadPro12Inch3] } - - /// All devices that feature a sensor housing in the screen - public static var allDevicesWithASensorHousing: [Device] { - return [.iPhoneX, .iPhoneXs, .iPhoneXsMax, .iPhoneXr] - } /// Returns whether or not the device has Touch ID public var isTouchIDCapable: Bool { @@ -638,16 +633,21 @@ public enum Device { public var isFaceIDCapable: Bool { return isOneOf(Device.allFaceIDCapableDevices) } - - /// Returns whether or not the device has a sensor housing - public var hasSensorHousing: Bool { - return isOneOf(Device.allDevicesWithASensorHousing) - } /// Returns whether or not the device has any biometric sensor (i.e. Touch ID or Face ID) public var hasBiometricSensor: Bool { return isTouchIDCapable || isFaceIDCapable } + + /// All devices that feature a sensor housing in the screen + public static var allDevicesWithASensorHousing: [Device] { + return [.iPhoneX, .iPhoneXs, .iPhoneXsMax, .iPhoneXr] + } + + /// Returns whether or not the device has a sensor housing + public var hasSensorHousing: Bool { + return isOneOf(Device.allDevicesWithASensorHousing) + } #elseif os(tvOS) /// All TVs From 8fc0c1f82dc69dce7f6f3ff50497dc1c84754a6b Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Mon, 4 Mar 2019 09:49:50 +0100 Subject: [PATCH 03/41] Rename allDevicesWithASensorHousing to allDevicesWithSensorHousing. --- Source/Device.generated.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Device.generated.swift b/Source/Device.generated.swift index 0c26e8f7..2d0adec7 100644 --- a/Source/Device.generated.swift +++ b/Source/Device.generated.swift @@ -640,13 +640,13 @@ public enum Device { } /// All devices that feature a sensor housing in the screen - public static var allDevicesWithASensorHousing: [Device] { + public static var allDevicesWithSensorHousing: [Device] { return [.iPhoneX, .iPhoneXs, .iPhoneXsMax, .iPhoneXr] } /// Returns whether or not the device has a sensor housing public var hasSensorHousing: Bool { - return isOneOf(Device.allDevicesWithASensorHousing) + return isOneOf(Device.allDevicesWithSensorHousing) } #elseif os(tvOS) From 3a8bd5ec83116a24f0c802ecab292822cc0d9940 Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Mon, 4 Mar 2019 11:58:43 +0100 Subject: [PATCH 04/41] Create allDevicesWithRoundedDisplayCorners and hasRoundedDisplayCorners variables. --- Source/Device.generated.swift | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Source/Device.generated.swift b/Source/Device.generated.swift index 2d0adec7..74b75424 100644 --- a/Source/Device.generated.swift +++ b/Source/Device.generated.swift @@ -648,6 +648,16 @@ public enum Device { public var hasSensorHousing: Bool { return isOneOf(Device.allDevicesWithSensorHousing) } + + /// All devices that feature a screen with rounded corners. + public static var allDevicesWithRoundedDisplayCorners: [Device] { + return [.iPhoneX, .iPhoneXs, .iPhoneXsMax, .iPhoneXr, .iPadPro11Inch, .iPadPro12Inch3] + } + + /// Returns whether or not the device has a screen with rounded corners. + public var hasRoundedDisplayCorners: Bool { + return isOneOf(Device.allDevicesWithRoundedDisplayCorners) + } #elseif os(tvOS) /// All TVs From 60ecca4c8e3f300e017f38586f5ebd95fbdda3b3 Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Mon, 4 Mar 2019 19:04:28 +0100 Subject: [PATCH 05/41] Create branch for 2.0 changes. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 72e16b55..b87e62c5 100644 --- a/README.md +++ b/README.md @@ -219,3 +219,4 @@ If you extended the functionality of DeviceKit yourself and want others to use i ## Contributors The complete list of people who contributed to this project is available [here](https://github.com/dennisweissmann/DeviceKit/graphs/contributors). DeviceKit wouldn't be what it is without you! Thank you very much! 🙏 + From 3b5c2add672f5740b38f79d68faeef4b0565b6b4 Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Mon, 4 Mar 2019 19:10:33 +0100 Subject: [PATCH 06/41] Rename iPhone Xs to XS and Xr to XR (fixes https://github.com/dennisweissmann/DeviceKit/issues/149) --- Source/Device.generated.swift | 50 +++++++++++++++++------------------ Source/Device.swift.gyb | 8 +++--- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/Source/Device.generated.swift b/Source/Device.generated.swift index 2d0adec7..4701cc9e 100644 --- a/Source/Device.generated.swift +++ b/Source/Device.generated.swift @@ -116,18 +116,18 @@ public enum Device { /// /// ![Image](https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP770/iphonex.png) case iPhoneX - /// Device is an [iPhone Xs](https://support.apple.com/kb/SP779) + /// Device is an [iPhone XS](https://support.apple.com/kb/SP779) /// /// ![Image](https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP779/SP779-iphone-xs.jpg) - case iPhoneXs - /// Device is an [iPhone Xs Max](https://support.apple.com/kb/SP780) + case iPhoneXS + /// Device is an [iPhone XS Max](https://support.apple.com/kb/SP780) /// /// ![Image](https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP780/SP780-iPhone-Xs-Max.jpg) - case iPhoneXsMax - /// Device is an [iPhone Xr](https://support.apple.com/kb/SP781) + case iPhoneXSMax + /// Device is an [iPhone XR](https://support.apple.com/kb/SP781) /// /// ![Image](https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP781/SP781-iPhone-xr.jpg) - case iPhoneXr + case iPhoneXR /// Device is an [iPad 2](https://support.apple.com/kb/SP622) /// /// ![Image](https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP622/SP622_01-ipad2-mul.png) @@ -307,9 +307,9 @@ public enum Device { case "iPhone10,1", "iPhone10,4": return iPhone8 case "iPhone10,2", "iPhone10,5": return iPhone8Plus case "iPhone10,3", "iPhone10,6": return iPhoneX - case "iPhone11,2": return iPhoneXs - case "iPhone11,4", "iPhone11,6": return iPhoneXsMax - case "iPhone11,8": return iPhoneXr + case "iPhone11,2": return iPhoneXS + case "iPhone11,4", "iPhone11,6": return iPhoneXSMax + case "iPhone11,8": return iPhoneXR case "iPad2,1", "iPad2,2", "iPad2,3", "iPad2,4": return iPad2 case "iPad3,1", "iPad3,2", "iPad3,3": return iPad3 case "iPad3,4", "iPad3,5", "iPad3,6": return iPad4 @@ -393,9 +393,9 @@ public enum Device { case .iPhone8: return 4.7 case .iPhone8Plus: return 5.5 case .iPhoneX: return 5.8 - case .iPhoneXs: return 5.8 - case .iPhoneXsMax: return 6.5 - case .iPhoneXr: return 6.1 + case .iPhoneXS: return 5.8 + case .iPhoneXSMax: return 6.5 + case .iPhoneXR: return 6.1 case .iPad2: return 9.7 case .iPad3: return 9.7 case .iPad4: return 9.7 @@ -457,9 +457,9 @@ public enum Device { case .iPhone8: return (width: 9, height: 16) case .iPhone8Plus: return (width: 9, height: 16) case .iPhoneX: return (width: 9, height: 19.5) - case .iPhoneXs: return (width: 9, height: 19.5) - case .iPhoneXsMax: return (width: 9, height: 19.5) - case .iPhoneXr: return (width: 9, height: 19.5) + case .iPhoneXS: return (width: 9, height: 19.5) + case .iPhoneXSMax: return (width: 9, height: 19.5) + case .iPhoneXR: return (width: 9, height: 19.5) case .iPad2: return (width: 3, height: 4) case .iPad3: return (width: 3, height: 4) case .iPad4: return (width: 3, height: 4) @@ -509,7 +509,7 @@ public enum Device { /// All iPhones public static var allPhones: [Device] { - return [.iPhone4, .iPhone4s, .iPhone5, .iPhone5c, .iPhone5s, .iPhone6, .iPhone6Plus, .iPhone6s, .iPhone6sPlus, .iPhone7, .iPhone7Plus, .iPhoneSE, .iPhone8, .iPhone8Plus, .iPhoneX, .iPhoneXs, .iPhoneXsMax, .iPhoneXr] + return [.iPhone4, .iPhone4s, .iPhone5, .iPhone5c, .iPhone5s, .iPhone6, .iPhone6Plus, .iPhone6s, .iPhone6sPlus, .iPhone7, .iPhone7Plus, .iPhoneSE, .iPhone8, .iPhone8Plus, .iPhoneX, .iPhoneXS, .iPhoneXSMax, .iPhoneXR] } /// All iPads @@ -519,7 +519,7 @@ public enum Device { /// All X-Series Devices public static var allXSeriesDevices: [Device] { - return [.iPhoneX, .iPhoneXs, .iPhoneXsMax, .iPhoneXr] + return [.iPhoneX, .iPhoneXS, .iPhoneXSMax, .iPhoneXR] } /// All Plus-Sized Devices @@ -605,7 +605,7 @@ public enum Device { public var isZoomed: Bool { // TODO: Longterm we need a better solution for this! - guard self != .iPhoneX && self != .iPhoneXs else { return false } + guard self != .iPhoneX && self != .iPhoneXS else { return false } if Int(UIScreen.main.scale.rounded()) == 3 { // Plus-sized return UIScreen.main.nativeScale > 2.7 @@ -621,7 +621,7 @@ public enum Device { /// All Face ID Capable Devices public static var allFaceIDCapableDevices: [Device] { - return [.iPhoneX, .iPhoneXs, .iPhoneXsMax, .iPhoneXr, .iPadPro11Inch, .iPadPro12Inch3] + return [.iPhoneX, .iPhoneXS, .iPhoneXSMax, .iPhoneXR, .iPadPro11Inch, .iPadPro12Inch3] } /// Returns whether or not the device has Touch ID @@ -786,9 +786,9 @@ public enum Device { case .iPhone8: return 326 case .iPhone8Plus: return 401 case .iPhoneX: return 458 - case .iPhoneXs: return 458 - case .iPhoneXsMax: return 458 - case .iPhoneXr: return 326 + case .iPhoneXS: return 458 + case .iPhoneXSMax: return 458 + case .iPhoneXR: return 326 case .iPad2: return 132 case .iPad3: return 264 case .iPad4: return 264 @@ -877,9 +877,9 @@ extension Device: CustomStringConvertible { case .iPhone8: return "iPhone 8" case .iPhone8Plus: return "iPhone 8 Plus" case .iPhoneX: return "iPhone X" - case .iPhoneXs: return "iPhone Xs" - case .iPhoneXsMax: return "iPhone Xs Max" - case .iPhoneXr: return "iPhone Xr" + case .iPhoneXS: return "iPhone XS" + case .iPhoneXSMax: return "iPhone XS Max" + case .iPhoneXR: return "iPhone XR" case .iPad2: return "iPad 2" case .iPad3: return "iPad 3" case .iPad4: return "iPad 4" diff --git a/Source/Device.swift.gyb b/Source/Device.swift.gyb index 45d60db9..b10dc1a2 100644 --- a/Source/Device.swift.gyb +++ b/Source/Device.swift.gyb @@ -50,9 +50,9 @@ iPhones = [ Device("iPhone8", "Device is an [iPhone 8](https://support.apple.com/kb/SP767)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP767/iphone8.png", ["iPhone10,1", "iPhone10,4"], 4.7, (9, 16), "iPhone 8", 326, False, False, False, False, True, False), Device("iPhone8Plus", "Device is an [iPhone 8 Plus](https://support.apple.com/kb/SP768)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP768/iphone8plus.png", ["iPhone10,2", "iPhone10,5"], 5.5, (9, 16), "iPhone 8 Plus", 401, True, False, False, False, True, False), Device("iPhoneX", "Device is an [iPhone X](https://support.apple.com/kb/SP770)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP770/iphonex.png", ["iPhone10,3", "iPhone10,6"], 5.8, (9, 19.5), "iPhone X", 458, False, False, False, True, False, True), - Device("iPhoneXs", "Device is an [iPhone Xs](https://support.apple.com/kb/SP779)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP779/SP779-iphone-xs.jpg", ["iPhone11,2"], 5.8, (9, 19.5), "iPhone Xs", 458, False, False, False, True, False, True), - Device("iPhoneXsMax", "Device is an [iPhone Xs Max](https://support.apple.com/kb/SP780)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP780/SP780-iPhone-Xs-Max.jpg", ["iPhone11,4", "iPhone11,6"], 6.5, (9, 19.5), "iPhone Xs Max", 458, False, False, False, True, False, True), - Device("iPhoneXr", "Device is an [iPhone Xr](https://support.apple.com/kb/SP781)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP781/SP781-iPhone-xr.jpg", ["iPhone11,8"], 6.1, (9, 19.5), "iPhone Xr", 326, False, False, False, True, False, True) + Device("iPhoneXS", "Device is an [iPhone XS](https://support.apple.com/kb/SP779)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP779/SP779-iphone-xs.jpg", ["iPhone11,2"], 5.8, (9, 19.5), "iPhone XS", 458, False, False, False, True, False, True), + Device("iPhoneXSMax", "Device is an [iPhone XS Max](https://support.apple.com/kb/SP780)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP780/SP780-iPhone-Xs-Max.jpg", ["iPhone11,4", "iPhone11,6"], 6.5, (9, 19.5), "iPhone XS Max", 458, False, False, False, True, False, True), + Device("iPhoneXR", "Device is an [iPhone XR](https://support.apple.com/kb/SP781)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP781/SP781-iPhone-xr.jpg", ["iPhone11,8"], 6.1, (9, 19.5), "iPhone XR", 326, False, False, False, True, False, True) ] iPads = [ @@ -450,7 +450,7 @@ public enum Device { public var isZoomed: Bool { // TODO: Longterm we need a better solution for this! - guard self != .iPhoneX && self != .iPhoneXs else { return false } + guard self != .iPhoneX && self != .iPhoneXS else { return false } if Int(UIScreen.main.scale.rounded()) == 3 { // Plus-sized return UIScreen.main.nativeScale > 2.7 From 374ff4e3b7be89038a2dfdb402db0fc49288c5d1 Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Mon, 4 Mar 2019 19:20:38 +0100 Subject: [PATCH 07/41] Fixed generation of allDevicesWithSensorHousing and hasSensorHousing through the gyb file. --- Source/Device.generated.swift | 6 +- Source/Device.swift.gyb | 113 +++++++++++++++++++--------------- 2 files changed, 65 insertions(+), 54 deletions(-) diff --git a/Source/Device.generated.swift b/Source/Device.generated.swift index 4701cc9e..caa095d9 100644 --- a/Source/Device.generated.swift +++ b/Source/Device.generated.swift @@ -638,12 +638,12 @@ public enum Device { public var hasBiometricSensor: Bool { return isTouchIDCapable || isFaceIDCapable } - + /// All devices that feature a sensor housing in the screen public static var allDevicesWithSensorHousing: [Device] { - return [.iPhoneX, .iPhoneXs, .iPhoneXsMax, .iPhoneXr] + return [.iPhoneX, .iPhoneXS, .iPhoneXSMax, .iPhoneXR] } - + /// Returns whether or not the device has a sensor housing public var hasSensorHousing: Bool { return isOneOf(Device.allDevicesWithSensorHousing) diff --git a/Source/Device.swift.gyb b/Source/Device.swift.gyb index b10dc1a2..a4f241cd 100644 --- a/Source/Device.swift.gyb +++ b/Source/Device.swift.gyb @@ -12,7 +12,7 @@ %{ class Device: - def __init__(self, caseName, comment, imageURL, identifiers, diagonal, screenRatio, description, ppi, isPlusFormFactor, isPadMiniFormFactor, isPro, isXSeries, hasTouchID, hasFaceID): + def __init__(self, caseName, comment, imageURL, identifiers, diagonal, screenRatio, description, ppi, isPlusFormFactor, isPadMiniFormFactor, isPro, isXSeries, hasTouchID, hasFaceID, hasSensorHousing): self.caseName = caseName self.comment = comment self.imageURL = imageURL @@ -27,62 +27,63 @@ class Device: self.isXSeries = isXSeries self.hasTouchID = hasTouchID self.hasFaceID = hasFaceID + self.hasSensorHousing = hasSensorHousing # iOS iPods = [ - Device("iPodTouch5", "Device is an [iPod Touch (5th generation)](https://support.apple.com/kb/SP657)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP657/sp657_ipod-touch_size.jpg", ["iPod5,1"], 4, (9, 16), "iPod Touch 5", 326, False, False, False, False, False, False), - Device("iPodTouch6", "Device is an [iPod Touch (6th generation)](https://support.apple.com/kb/SP720)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP720/SP720-ipod-touch-specs-color-sg-2015.jpg", ["iPod7,1"], 4, (9, 16), "iPod Touch 6", 326, False, False, False, False, False, False) + Device("iPodTouch5", "Device is an [iPod Touch (5th generation)](https://support.apple.com/kb/SP657)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP657/sp657_ipod-touch_size.jpg", ["iPod5,1"], 4, (9, 16), "iPod Touch 5", 326, False, False, False, False, False, False, False), + Device("iPodTouch6", "Device is an [iPod Touch (6th generation)](https://support.apple.com/kb/SP720)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP720/SP720-ipod-touch-specs-color-sg-2015.jpg", ["iPod7,1"], 4, (9, 16), "iPod Touch 6", 326, False, False, False, False, False, False, False) ] iPhones = [ - Device("iPhone4", "Device is an [iPhone 4](https://support.apple.com/kb/SP587)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP643/sp643_iphone4s_color_black.jpg", ["iPhone3,1", "iPhone3,2", "iPhone3,3"], 3.5, (2, 3), "iPhone 4", 326, False, False, False, False, False, False), - Device("iPhone4s", "Device is an [iPhone 4s](https://support.apple.com/kb/SP643)", "https://support.apple.com/library/content/dam/edam/applecare/images/en_US/iphone/iphone5s/iphone_4s.png", ["iPhone4,1"], 3.5, (2, 3), "iPhone 4s", 326, False, False, False, False, False, False), - Device("iPhone5", "Device is an [iPhone 5](https://support.apple.com/kb/SP655)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP655/sp655_iphone5_color.jpg", ["iPhone5,1", "iPhone5,2"], 4, (9, 16), "iPhone 5", 326, False, False, False, False, False, False), - Device("iPhone5c", "Device is an [iPhone 5c](https://support.apple.com/kb/SP684)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP684/SP684-color_yellow.jpg", ["iPhone5,3", "iPhone5,4"], 4, (9, 16), "iPhone 5c", 326, False, False, False, False, False, False), - Device("iPhone5s", "Device is an [iPhone 5s](https://support.apple.com/kb/SP685)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP685/SP685-color_black.jpg", ["iPhone6,1", "iPhone6,2"], 4, (9, 16), "iPhone 5s", 326, False, False, False, False, True, False), - Device("iPhone6", "Device is an [iPhone 6](https://support.apple.com/kb/SP705)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP705/SP705-iphone_6-mul.png", ["iPhone7,2"], 4.7, (9, 16), "iPhone 6", 326, False, False, False, False, True, False), - Device("iPhone6Plus", "Device is an [iPhone 6 Plus](https://support.apple.com/kb/SP706)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP706/SP706-iphone_6_plus-mul.png", ["iPhone7,1"], 5.5, (9, 16), "iPhone 6 Plus", 401, True, False, False, False, True, False), - Device("iPhone6s", "Device is an [iPhone 6s](https://support.apple.com/kb/SP726)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP726/SP726-iphone6s-gray-select-2015.png", ["iPhone8,1"], 4.7, (9, 16), "iPhone 6s", 326, False, False, False, False, True, False), - Device("iPhone6sPlus", "Device is an [iPhone 6s Plus](https://support.apple.com/kb/SP727)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP727/SP727-iphone6s-plus-gray-select-2015.png", ["iPhone8,2"], 5.5, (9, 16), "iPhone 6s Plus", 401, True, False, False, False, True, False), - Device("iPhone7", "Device is an [iPhone 7](https://support.apple.com/kb/SP743)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP743/iphone7-black.png", ["iPhone9,1", "iPhone9,3"], 4.7, (9, 16), "iPhone 7", 326, False, False, False, False, True, False), - Device("iPhone7Plus", "Device is an [iPhone 7 Plus](https://support.apple.com/kb/SP744)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP744/iphone7-plus-black.png", ["iPhone9,2", "iPhone9,4"], 5.5, (9, 16), "iPhone 7 Plus", 401, True, False, False, False, True, False), - Device("iPhoneSE", "Device is an [iPhone SE](https://support.apple.com/kb/SP738)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP738/SP738.png", ["iPhone8,4"], 4, (9, 16), "iPhone SE", 326, False, False, False, False, True, False), - Device("iPhone8", "Device is an [iPhone 8](https://support.apple.com/kb/SP767)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP767/iphone8.png", ["iPhone10,1", "iPhone10,4"], 4.7, (9, 16), "iPhone 8", 326, False, False, False, False, True, False), - Device("iPhone8Plus", "Device is an [iPhone 8 Plus](https://support.apple.com/kb/SP768)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP768/iphone8plus.png", ["iPhone10,2", "iPhone10,5"], 5.5, (9, 16), "iPhone 8 Plus", 401, True, False, False, False, True, False), - Device("iPhoneX", "Device is an [iPhone X](https://support.apple.com/kb/SP770)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP770/iphonex.png", ["iPhone10,3", "iPhone10,6"], 5.8, (9, 19.5), "iPhone X", 458, False, False, False, True, False, True), - Device("iPhoneXS", "Device is an [iPhone XS](https://support.apple.com/kb/SP779)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP779/SP779-iphone-xs.jpg", ["iPhone11,2"], 5.8, (9, 19.5), "iPhone XS", 458, False, False, False, True, False, True), - Device("iPhoneXSMax", "Device is an [iPhone XS Max](https://support.apple.com/kb/SP780)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP780/SP780-iPhone-Xs-Max.jpg", ["iPhone11,4", "iPhone11,6"], 6.5, (9, 19.5), "iPhone XS Max", 458, False, False, False, True, False, True), - Device("iPhoneXR", "Device is an [iPhone XR](https://support.apple.com/kb/SP781)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP781/SP781-iPhone-xr.jpg", ["iPhone11,8"], 6.1, (9, 19.5), "iPhone XR", 326, False, False, False, True, False, True) + Device("iPhone4", "Device is an [iPhone 4](https://support.apple.com/kb/SP587)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP643/sp643_iphone4s_color_black.jpg", ["iPhone3,1", "iPhone3,2", "iPhone3,3"], 3.5, (2, 3), "iPhone 4", 326, False, False, False, False, False, False, False), + Device("iPhone4s", "Device is an [iPhone 4s](https://support.apple.com/kb/SP643)", "https://support.apple.com/library/content/dam/edam/applecare/images/en_US/iphone/iphone5s/iphone_4s.png", ["iPhone4,1"], 3.5, (2, 3), "iPhone 4s", 326, False, False, False, False, False, False, False), + Device("iPhone5", "Device is an [iPhone 5](https://support.apple.com/kb/SP655)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP655/sp655_iphone5_color.jpg", ["iPhone5,1", "iPhone5,2"], 4, (9, 16), "iPhone 5", 326, False, False, False, False, False, False, False), + Device("iPhone5c", "Device is an [iPhone 5c](https://support.apple.com/kb/SP684)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP684/SP684-color_yellow.jpg", ["iPhone5,3", "iPhone5,4"], 4, (9, 16), "iPhone 5c", 326, False, False, False, False, False, False, False), + Device("iPhone5s", "Device is an [iPhone 5s](https://support.apple.com/kb/SP685)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP685/SP685-color_black.jpg", ["iPhone6,1", "iPhone6,2"], 4, (9, 16), "iPhone 5s", 326, False, False, False, False, True, False, False), + Device("iPhone6", "Device is an [iPhone 6](https://support.apple.com/kb/SP705)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP705/SP705-iphone_6-mul.png", ["iPhone7,2"], 4.7, (9, 16), "iPhone 6", 326, False, False, False, False, True, False, False), + Device("iPhone6Plus", "Device is an [iPhone 6 Plus](https://support.apple.com/kb/SP706)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP706/SP706-iphone_6_plus-mul.png", ["iPhone7,1"], 5.5, (9, 16), "iPhone 6 Plus", 401, True, False, False, False, True, False, False), + Device("iPhone6s", "Device is an [iPhone 6s](https://support.apple.com/kb/SP726)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP726/SP726-iphone6s-gray-select-2015.png", ["iPhone8,1"], 4.7, (9, 16), "iPhone 6s", 326, False, False, False, False, True, False, False), + Device("iPhone6sPlus", "Device is an [iPhone 6s Plus](https://support.apple.com/kb/SP727)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP727/SP727-iphone6s-plus-gray-select-2015.png", ["iPhone8,2"], 5.5, (9, 16), "iPhone 6s Plus", 401, True, False, False, False, True, False, False), + Device("iPhone7", "Device is an [iPhone 7](https://support.apple.com/kb/SP743)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP743/iphone7-black.png", ["iPhone9,1", "iPhone9,3"], 4.7, (9, 16), "iPhone 7", 326, False, False, False, False, True, False, False), + Device("iPhone7Plus", "Device is an [iPhone 7 Plus](https://support.apple.com/kb/SP744)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP744/iphone7-plus-black.png", ["iPhone9,2", "iPhone9,4"], 5.5, (9, 16), "iPhone 7 Plus", 401, True, False, False, False, True, False, False), + Device("iPhoneSE", "Device is an [iPhone SE](https://support.apple.com/kb/SP738)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP738/SP738.png", ["iPhone8,4"], 4, (9, 16), "iPhone SE", 326, False, False, False, False, True, False, False), + Device("iPhone8", "Device is an [iPhone 8](https://support.apple.com/kb/SP767)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP767/iphone8.png", ["iPhone10,1", "iPhone10,4"], 4.7, (9, 16), "iPhone 8", 326, False, False, False, False, True, False, False), + Device("iPhone8Plus", "Device is an [iPhone 8 Plus](https://support.apple.com/kb/SP768)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP768/iphone8plus.png", ["iPhone10,2", "iPhone10,5"], 5.5, (9, 16), "iPhone 8 Plus", 401, True, False, False, False, True, False, False), + Device("iPhoneX", "Device is an [iPhone X](https://support.apple.com/kb/SP770)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP770/iphonex.png", ["iPhone10,3", "iPhone10,6"], 5.8, (9, 19.5), "iPhone X", 458, False, False, False, True, False, True, True), + Device("iPhoneXS", "Device is an [iPhone XS](https://support.apple.com/kb/SP779)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP779/SP779-iphone-xs.jpg", ["iPhone11,2"], 5.8, (9, 19.5), "iPhone XS", 458, False, False, False, True, False, True, True), + Device("iPhoneXSMax", "Device is an [iPhone XS Max](https://support.apple.com/kb/SP780)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP780/SP780-iPhone-Xs-Max.jpg", ["iPhone11,4", "iPhone11,6"], 6.5, (9, 19.5), "iPhone XS Max", 458, False, False, False, True, False, True, True), + Device("iPhoneXR", "Device is an [iPhone XR](https://support.apple.com/kb/SP781)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP781/SP781-iPhone-xr.jpg", ["iPhone11,8"], 6.1, (9, 19.5), "iPhone XR", 326, False, False, False, True, False, True, True) ] iPads = [ - Device("iPad2", "Device is an [iPad 2](https://support.apple.com/kb/SP622)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP622/SP622_01-ipad2-mul.png", ["iPad2,1", "iPad2,2", "iPad2,3", "iPad2,4"], 9.7, (3, 4), "iPad 2", 132, False, False, False, False, False, False), - Device("iPad3", "Device is an [iPad (3rd generation)](https://support.apple.com/kb/SP647)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP662/sp662_ipad-4th-gen_color.jpg", ["iPad3,1", "iPad3,2", "iPad3,3"], 9.7, (3, 4), "iPad 3", 264, False, False, False, False, False, False), - Device("iPad4", "Device is an [iPad (4th generation)](https://support.apple.com/kb/SP662)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP662/sp662_ipad-4th-gen_color.jpg", ["iPad3,4", "iPad3,5", "iPad3,6"], 9.7, (3, 4), "iPad 4", 264, False, False, False, False, False, False), - Device("iPadAir", "Device is an [iPad Air](https://support.apple.com/kb/SP692)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP692/SP692-specs_color-mul.png", ["iPad4,1", "iPad4,2", "iPad4,3"], 9.7, (3, 4), "iPad Air", 264, False, False, False, False, False, False), - Device("iPadAir2", "Device is an [iPad Air 2](https://support.apple.com/kb/SP708)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP708/SP708-space_gray.jpeg", ["iPad5,3", "iPad5,4"], 9.7, (3, 4), "iPad Air 2", 264, False, False, False, False, True, False), - Device("iPad5", "Device is an [iPad 5](https://support.apple.com/kb/SP751)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP751/ipad_5th_generation.png", ["iPad6,11", "iPad6,12"], 9.7, (3, 4), "iPad 5", 264, False, False, False, False, True, False), - Device("iPad6", "Device is an [iPad 6](https://support.apple.com/kb/NotYetAvailable)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP751/ipad_5th_generation.png", ["iPad7,5", "iPad7,6"], 9.7, (3, 4), "iPad 6", 264, False, False, False, False, True, False), - Device("iPadMini", "Device is an [iPad Mini](https://support.apple.com/kb/SP661)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP661/sp661_ipad_mini_color.jpg", ["iPad2,5", "iPad2,6", "iPad2,7"], 7.9, (3, 4), "iPad Mini", 163, False, True, False, False, False, False), - Device("iPadMini2", "Device is an [iPad Mini 2](https://support.apple.com/kb/SP693)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP693/SP693-specs_color-mul.png", ["iPad4,4", "iPad4,5", "iPad4,6"], 7.9, (3, 4), "iPad Mini 2", 326, False, True, False, False, False, False), - Device("iPadMini3", "Device is an [iPad Mini 3](https://support.apple.com/kb/SP709)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP709/SP709-space_gray.jpeg", ["iPad4,7", "iPad4,8", "iPad4,9"], 7.9, (3, 4), "iPad Mini 3", 326, False, True, False, False, True, False), - Device("iPadMini4", "Device is an [iPad Mini 4](https://support.apple.com/kb/SP725)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP725/SP725ipad-mini-4.png", ["iPad5,1", "iPad5,2"], 7.9, (3, 4), "iPad Mini 4", 326, False, True, False, False, True, False), - Device("iPadPro9Inch", "Device is an [iPad Pro 9.7-inch](https://support.apple.com/kb/SP739)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP739/SP739.png", ["iPad6,3", "iPad6,4"], 9.7, (3, 4), "iPad Pro (9.7-inch)", 264, False, False, True, False, True, False), - Device("iPadPro12Inch", "Device is an [iPad Pro 12-inch](https://support.apple.com/kb/sp723)", "http://images.apple.com/v/ipad-pro/c/images/shared/buystrip/ipad_pro_large_2x.png", ["iPad6,7", "iPad6,8"], 12.9, (3, 4), "iPad Pro (12.9-inch)", 264, False, False, True, False, True, False), - Device("iPadPro12Inch2", "Device is an [iPad Pro 12-inch (2nd generation)](https://support.apple.com/kb/SP761)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP761/ipad-pro-12in-hero-201706.png", ["iPad7,1", "iPad7,2"], 12.9, (3, 4), "iPad Pro (12.9-inch) (2nd generation)", 264, False, False, True, False, True, False), - Device("iPadPro10Inch", "Device is an [iPad Pro 10.5-inch](https://support.apple.com/kb/SP762)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP761/ipad-pro-10in-hero-201706.png", ["iPad7,3", "iPad7,4"], 10.5, (3, 4), "iPad Pro (10.5-inch)", 264, False, False, True, False, True, False), - Device("iPadPro11Inch", "Device is an [iPad Pro 11-inch](https://support.apple.com/kb/not-published-yet)", "https://support.apple.com/not-published-yet", ["iPad8,1", "iPad8,2", "iPad8,3", "iPad8,4"], 11.0, (139, 199), "iPad Pro (11-inch)", 264, False, False, True, False, False, True), - Device("iPadPro12Inch3", "Device is an [iPad Pro 12.9-inch (3rd generation)](https://support.apple.com/kb/not-published-yet)", "https://support.apple.com/not-published-yet", ["iPad8,5", "iPad8,6", "iPad8,7", "iPad8,8"], 12.9, (512, 683), "iPad Pro (12.9-inch) (3rd generation)", 264, False, False, True, False, False, True) + Device("iPad2", "Device is an [iPad 2](https://support.apple.com/kb/SP622)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP622/SP622_01-ipad2-mul.png", ["iPad2,1", "iPad2,2", "iPad2,3", "iPad2,4"], 9.7, (3, 4), "iPad 2", 132, False, False, False, False, False, False, False), + Device("iPad3", "Device is an [iPad (3rd generation)](https://support.apple.com/kb/SP647)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP662/sp662_ipad-4th-gen_color.jpg", ["iPad3,1", "iPad3,2", "iPad3,3"], 9.7, (3, 4), "iPad 3", 264, False, False, False, False, False, False, False), + Device("iPad4", "Device is an [iPad (4th generation)](https://support.apple.com/kb/SP662)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP662/sp662_ipad-4th-gen_color.jpg", ["iPad3,4", "iPad3,5", "iPad3,6"], 9.7, (3, 4), "iPad 4", 264, False, False, False, False, False, False, False), + Device("iPadAir", "Device is an [iPad Air](https://support.apple.com/kb/SP692)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP692/SP692-specs_color-mul.png", ["iPad4,1", "iPad4,2", "iPad4,3"], 9.7, (3, 4), "iPad Air", 264, False, False, False, False, False, False, False), + Device("iPadAir2", "Device is an [iPad Air 2](https://support.apple.com/kb/SP708)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP708/SP708-space_gray.jpeg", ["iPad5,3", "iPad5,4"], 9.7, (3, 4), "iPad Air 2", 264, False, False, False, False, True, False, False), + Device("iPad5", "Device is an [iPad 5](https://support.apple.com/kb/SP751)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP751/ipad_5th_generation.png", ["iPad6,11", "iPad6,12"], 9.7, (3, 4), "iPad 5", 264, False, False, False, False, True, False, False), + Device("iPad6", "Device is an [iPad 6](https://support.apple.com/kb/NotYetAvailable)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP751/ipad_5th_generation.png", ["iPad7,5", "iPad7,6"], 9.7, (3, 4), "iPad 6", 264, False, False, False, False, True, False, False), + Device("iPadMini", "Device is an [iPad Mini](https://support.apple.com/kb/SP661)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP661/sp661_ipad_mini_color.jpg", ["iPad2,5", "iPad2,6", "iPad2,7"], 7.9, (3, 4), "iPad Mini", 163, False, True, False, False, False, False, False), + Device("iPadMini2", "Device is an [iPad Mini 2](https://support.apple.com/kb/SP693)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP693/SP693-specs_color-mul.png", ["iPad4,4", "iPad4,5", "iPad4,6"], 7.9, (3, 4), "iPad Mini 2", 326, False, True, False, False, False, False, False), + Device("iPadMini3", "Device is an [iPad Mini 3](https://support.apple.com/kb/SP709)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP709/SP709-space_gray.jpeg", ["iPad4,7", "iPad4,8", "iPad4,9"], 7.9, (3, 4), "iPad Mini 3", 326, False, True, False, False, True, False, False), + Device("iPadMini4", "Device is an [iPad Mini 4](https://support.apple.com/kb/SP725)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP725/SP725ipad-mini-4.png", ["iPad5,1", "iPad5,2"], 7.9, (3, 4), "iPad Mini 4", 326, False, True, False, False, True, False, False), + Device("iPadPro9Inch", "Device is an [iPad Pro 9.7-inch](https://support.apple.com/kb/SP739)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP739/SP739.png", ["iPad6,3", "iPad6,4"], 9.7, (3, 4), "iPad Pro (9.7-inch)", 264, False, False, True, False, True, False, False), + Device("iPadPro12Inch", "Device is an [iPad Pro 12-inch](https://support.apple.com/kb/sp723)", "http://images.apple.com/v/ipad-pro/c/images/shared/buystrip/ipad_pro_large_2x.png", ["iPad6,7", "iPad6,8"], 12.9, (3, 4), "iPad Pro (12.9-inch)", 264, False, False, True, False, True, False, False), + Device("iPadPro12Inch2", "Device is an [iPad Pro 12-inch (2nd generation)](https://support.apple.com/kb/SP761)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP761/ipad-pro-12in-hero-201706.png", ["iPad7,1", "iPad7,2"], 12.9, (3, 4), "iPad Pro (12.9-inch) (2nd generation)", 264, False, False, True, False, True, False, False), + Device("iPadPro10Inch", "Device is an [iPad Pro 10.5-inch](https://support.apple.com/kb/SP762)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP761/ipad-pro-10in-hero-201706.png", ["iPad7,3", "iPad7,4"], 10.5, (3, 4), "iPad Pro (10.5-inch)", 264, False, False, True, False, True, False, False), + Device("iPadPro11Inch", "Device is an [iPad Pro 11-inch](https://support.apple.com/kb/not-published-yet)", "https://support.apple.com/not-published-yet", ["iPad8,1", "iPad8,2", "iPad8,3", "iPad8,4"], 11.0, (139, 199), "iPad Pro (11-inch)", 264, False, False, True, False, False, True, False), + Device("iPadPro12Inch3", "Device is an [iPad Pro 12.9-inch (3rd generation)](https://support.apple.com/kb/not-published-yet)", "https://support.apple.com/not-published-yet", ["iPad8,5", "iPad8,6", "iPad8,7", "iPad8,8"], 12.9, (512, 683), "iPad Pro (12.9-inch) (3rd generation)", 264, False, False, True, False, False, True, False) ] homePods = [ - Device("homePod", "Device is a [HomePod](https://www.apple.com/homepod/)", "https://images.apple.com/v/homepod/d/images/overview/homepod_side_dark_large_2x.jpg", ["AudioAccessory1,1"], -1, (4, 5), "HomePod", -1, False, False, False, False, False, False), + Device("homePod", "Device is a [HomePod](https://www.apple.com/homepod/)", "https://images.apple.com/v/homepod/d/images/overview/homepod_side_dark_large_2x.jpg", ["AudioAccessory1,1"], -1, (4, 5), "HomePod", -1, False, False, False, False, False, False, False), ] # tvOS tvs = [ - Device("appleTV4", "Device is an [Apple TV 4](https://support.apple.com/kb/SP724)", "http://images.apple.com/v/tv/c/images/overview/buy_tv_large_2x.jpg", ["AppleTV5,3"], 0, (), "Apple TV 4", -1, False, False, False, False, False, False), - Device("appleTV4K", "Device is an [Apple TV 4K](https://support.apple.com/kb/SP769)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP769/appletv4k.png", ["AppleTV6,2"], 0, (), "Apple TV 4K", -1, False, False, False, False, False, False) + Device("appleTV4", "Device is an [Apple TV 4](https://support.apple.com/kb/SP724)", "http://images.apple.com/v/tv/c/images/overview/buy_tv_large_2x.jpg", ["AppleTV5,3"], 0, (), "Apple TV 4", -1, False, False, False, False, False, False, False), + Device("appleTV4K", "Device is an [Apple TV 4K](https://support.apple.com/kb/SP769)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP769/appletv4k.png", ["AppleTV6,2"], 0, (), "Apple TV 4K", -1, False, False, False, False, False, False, False) ] # watchOS @@ -91,70 +92,70 @@ watches = [ "appleWatchSeries0_38mm", "Device is an [Apple Watch (1st generation)](https://support.apple.com/kb/SP735)", "https://km.support.apple.com/resources/sites/APPLE/content/live/IMAGES/0/IM784/en_US/apple_watch_sport-240.png", - ["Watch1,1"], 1.5, (4,5), "Apple Watch (1st generation) 38mm", 290, False, False, False, False, False, False), + ["Watch1,1"], 1.5, (4,5), "Apple Watch (1st generation) 38mm", 290, False, False, False, False, False, False, False), Device( "appleWatchSeries0_42mm", "Device is an [Apple Watch (1st generation)](https://support.apple.com/kb/SP735)", "https://km.support.apple.com/resources/sites/APPLE/content/live/IMAGES/0/IM784/en_US/apple_watch_sport-240.png", - ["Watch1,2"], 1.6, (4,5), "Apple Watch (1st generation) 42mm", 303, False, False, False, False, False, False), + ["Watch1,2"], 1.6, (4,5), "Apple Watch (1st generation) 42mm", 303, False, False, False, False, False, False, False), Device( "appleWatchSeries1_38mm", "Device is an [Apple Watch Series 1](https://support.apple.com/kb/SP745)", "https://km.support.apple.com/resources/sites/APPLE/content/live/IMAGES/0/IM848/en_US/applewatch-series2-aluminum-temp-240.png", - ["Watch2,6"], 1.5, (4,5), "Apple Watch Series 1 38mm", 290, False, False, False, False, False, False), + ["Watch2,6"], 1.5, (4,5), "Apple Watch Series 1 38mm", 290, False, False, False, False, False, False, False), Device( "appleWatchSeries1_42mm", "Device is an [Apple Watch Series 1](https://support.apple.com/kb/SP745)", "https://km.support.apple.com/resources/sites/APPLE/content/live/IMAGES/0/IM848/en_US/applewatch-series2-aluminum-temp-240.png", - ["Watch2,7"], 1.6, (4,5), "Apple Watch Series 1 42mm", 303, False, False, False, False, False, False), + ["Watch2,7"], 1.6, (4,5), "Apple Watch Series 1 42mm", 303, False, False, False, False, False, False, False), Device( "appleWatchSeries2_38mm", "Device is an [Apple Watch Series 2](https://support.apple.com/kb/SP746)", "https://km.support.apple.com/resources/sites/APPLE/content/live/IMAGES/0/IM852/en_US/applewatch-series2-hermes-240.png", - ["Watch2,3"], 1.5, (4,5), "Apple Watch Series 2 38mm", 290, False, False, False, False, False, False), + ["Watch2,3"], 1.5, (4,5), "Apple Watch Series 2 38mm", 290, False, False, False, False, False, False, False), Device( "appleWatchSeries2_42mm", "Device is an [Apple Watch Series 2](https://support.apple.com/kb/SP746)", "https://km.support.apple.com/resources/sites/APPLE/content/live/IMAGES/0/IM852/en_US/applewatch-series2-hermes-240.png", - ["Watch2,4"], 1.6, (4,5), "Apple Watch Series 2 42mm", 303, False, False, False, False, False, False), + ["Watch2,4"], 1.6, (4,5), "Apple Watch Series 2 42mm", 303, False, False, False, False, False, False, False), Device( "appleWatchSeries3_38mm", "Device is an [Apple Watch Series 3](https://support.apple.com/kb/SP766)", "https://km.support.apple.com/resources/sites/APPLE/content/live/IMAGES/0/IM893/en_US/apple-watch-s3-nikeplus-240.png", - ["Watch3,1", "Watch3,3"], 1.5, (4,5), "Apple Watch Series 3 38mm", 290, False, False, False, False, False, False), + ["Watch3,1", "Watch3,3"], 1.5, (4,5), "Apple Watch Series 3 38mm", 290, False, False, False, False, False, False, False), Device( "appleWatchSeries3_42mm", "Device is an [Apple Watch Series 3](https://support.apple.com/kb/SP766)", "https://km.support.apple.com/resources/sites/APPLE/content/live/IMAGES/0/IM893/en_US/apple-watch-s3-nikeplus-240.png", - ["Watch3,2", "Watch3,4"], 1.6, (4,5), "Apple Watch Series 3 42mm", 303, False, False, False, False, False, False), + ["Watch3,2", "Watch3,4"], 1.6, (4,5), "Apple Watch Series 3 42mm", 303, False, False, False, False, False, False, False), Device( "appleWatchSeries4_40mm", "Device is an [Apple Watch Series 4](https://support.apple.com/kb/SP778)", "https://km.support.apple.com/resources/sites/APPLE/content/live/IMAGES/0/IM911/en_US/aw-series4-nike-240.png", - ["Watch4,1", "Watch4,3"], 1.8, (4,5), "Apple Watch Series 4 40mm", 326, False, False, False, False, False, False), + ["Watch4,1", "Watch4,3"], 1.8, (4,5), "Apple Watch Series 4 40mm", 326, False, False, False, False, False, False, False), Device( "appleWatchSeries4_44mm", "Device is an [Apple Watch Series 4](https://support.apple.com/kb/SP778)", "https://km.support.apple.com/resources/sites/APPLE/content/live/IMAGES/0/IM911/en_US/aw-series4-nike-240.png", - ["Watch4,2", "Watch4,4"], 2.0, (4,5), "Apple Watch Series 4 44mm", 326, False, False, False, False, False, False), + ["Watch4,2", "Watch4,4"], 2.0, (4,5), "Apple Watch Series 4 44mm", 326, False, False, False, False, False, False, False), ] iOSDevices = iPods + iPhones + iPads + homePods @@ -483,6 +484,16 @@ public enum Device { public var hasBiometricSensor: Bool { return isTouchIDCapable || isFaceIDCapable } + + /// All devices that feature a sensor housing in the screen + public static var allDevicesWithSensorHousing: [Device] { + return [${', '.join(list(map(lambda device: "." + device.caseName, list(filter(lambda device: device.hasSensorHousing == True, iOSDevices)))))}] + } + + /// Returns whether or not the device has a sensor housing + public var hasSensorHousing: Bool { + return isOneOf(Device.allDevicesWithSensorHousing) + } #elseif os(tvOS) /// All TVs From 29d20904fb22afd85ed48ad2486ed0a186cc8a06 Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Mon, 4 Mar 2019 19:37:51 +0100 Subject: [PATCH 08/41] Check if device is current. --- Source/Device.generated.swift | 39 ++++++++++++++++++++++++++++------- Source/Device.swift.gyb | 39 ++++++++++++++++++++++++++++------- 2 files changed, 64 insertions(+), 14 deletions(-) diff --git a/Source/Device.generated.swift b/Source/Device.generated.swift index caa095d9..e01c397d 100644 --- a/Source/Device.generated.swift +++ b/Source/Device.generated.swift @@ -719,9 +719,16 @@ public enum Device { public func isOneOf(_ devices: [Device]) -> Bool { return devices.contains(self) } + + private var isCurrent: Bool { + return self == Device.instance + } /// The name identifying the device (e.g. "Dennis' iPhone"). - public var name: String { + public var name: String? { + if !isCurrent { + return nil + } #if os(watchOS) return WKInterfaceDevice.current().name #else @@ -730,7 +737,10 @@ public enum Device { } /// The name of the operating system running on the device represented by the receiver (e.g. "iOS" or "tvOS"). - public var systemName: String { + public var systemName: String? { + if !isCurrent { + return nil + } #if os(watchOS) return WKInterfaceDevice.current().systemName #else @@ -739,7 +749,10 @@ public enum Device { } /// The current version of the operating system (e.g. 8.4 or 9.2). - public var systemVersion: String { + public var systemVersion: String? { + if !isCurrent { + return nil + } #if os(watchOS) return WKInterfaceDevice.current().systemVersion #else @@ -748,7 +761,10 @@ public enum Device { } /// The model of the device (e.g. "iPhone" or "iPod Touch"). - public var model: String { + public var model: String? { + if !isCurrent { + return nil + } #if os(watchOS) return WKInterfaceDevice.current().model #else @@ -757,7 +773,10 @@ public enum Device { } /// The model of the device as a localized string. - public var localizedModel: String { + public var localizedModel: String? { + if !isCurrent { + return nil + } #if os(watchOS) return WKInterfaceDevice.current().localizedModel #else @@ -1020,12 +1039,18 @@ extension Device { } /// The state of the battery - public var batteryState: BatteryState { + public var batteryState: BatteryState? { + if !isCurrent { + return nil + } return BatteryState() } /// Battery level ranges from 0 (fully discharged) to 100 (100% charged). - public var batteryLevel: Int { + public var batteryLevel: Int? { + if !isCurrent { + return nil + } switch BatteryState() { case .charging(let value): return value case .full: return 100 diff --git a/Source/Device.swift.gyb b/Source/Device.swift.gyb index a4f241cd..f9180dc4 100644 --- a/Source/Device.swift.gyb +++ b/Source/Device.swift.gyb @@ -565,9 +565,16 @@ public enum Device { public func isOneOf(_ devices: [Device]) -> Bool { return devices.contains(self) } + + private var isCurrent: Bool { + return self == Device.instance + } /// The name identifying the device (e.g. "Dennis' iPhone"). - public var name: String { + public var name: String? { + if !isCurrent { + return nil + } #if os(watchOS) return WKInterfaceDevice.current().name #else @@ -576,7 +583,10 @@ public enum Device { } /// The name of the operating system running on the device represented by the receiver (e.g. "iOS" or "tvOS"). - public var systemName: String { + public var systemName: String? { + if !isCurrent { + return nil + } #if os(watchOS) return WKInterfaceDevice.current().systemName #else @@ -585,7 +595,10 @@ public enum Device { } /// The current version of the operating system (e.g. 8.4 or 9.2). - public var systemVersion: String { + public var systemVersion: String? { + if !isCurrent { + return nil + } #if os(watchOS) return WKInterfaceDevice.current().systemVersion #else @@ -594,7 +607,10 @@ public enum Device { } /// The model of the device (e.g. "iPhone" or "iPod Touch"). - public var model: String { + public var model: String? { + if !isCurrent { + return nil + } #if os(watchOS) return WKInterfaceDevice.current().model #else @@ -603,7 +619,10 @@ public enum Device { } /// The model of the device as a localized string. - public var localizedModel: String { + public var localizedModel: String? { + if !isCurrent { + return nil + } #if os(watchOS) return WKInterfaceDevice.current().localizedModel #else @@ -783,12 +802,18 @@ extension Device { } /// The state of the battery - public var batteryState: BatteryState { + public var batteryState: BatteryState? { + if !isCurrent { + return nil + } return BatteryState() } /// Battery level ranges from 0 (fully discharged) to 100 (100% charged). - public var batteryLevel: Int { + public var batteryLevel: Int? { + if !isCurrent { + return nil + } switch BatteryState() { case .charging(let value): return value case .full: return 100 From 7fd93ec3a5903a0773995e60c50bfc3d996f2c27 Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Mon, 4 Mar 2019 19:38:06 +0100 Subject: [PATCH 09/41] Fixed formatting. --- Source/Device.generated.swift | 4 ++-- Source/Device.swift.gyb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Device.generated.swift b/Source/Device.generated.swift index e01c397d..0abaa7a9 100644 --- a/Source/Device.generated.swift +++ b/Source/Device.generated.swift @@ -991,7 +991,7 @@ extension Device { switch UIDevice.current.batteryState { case .charging: self = .charging(batteryLevel) case .full: self = .full - case .unplugged:self = .unplugged(batteryLevel) + case .unplugged: self = .unplugged(batteryLevel) case .unknown: self = .full // Should never happen since `batteryMonitoring` is enabled. } UIDevice.current.isBatteryMonitoringEnabled = wasBatteryMonitoringEnabled @@ -1005,7 +1005,7 @@ extension Device { switch WKInterfaceDevice.current().batteryState { case .charging: self = .charging(batteryLevel) case .full: self = .full - case .unplugged:self = .unplugged(batteryLevel) + case .unplugged: self = .unplugged(batteryLevel) case .unknown: self = .full // Should never happen since `batteryMonitoring` is enabled. } WKInterfaceDevice.current().isBatteryMonitoringEnabled = wasBatteryMonitoringEnabled diff --git a/Source/Device.swift.gyb b/Source/Device.swift.gyb index f9180dc4..f975930b 100644 --- a/Source/Device.swift.gyb +++ b/Source/Device.swift.gyb @@ -754,7 +754,7 @@ extension Device { switch UIDevice.current.batteryState { case .charging: self = .charging(batteryLevel) case .full: self = .full - case .unplugged:self = .unplugged(batteryLevel) + case .unplugged: self = .unplugged(batteryLevel) case .unknown: self = .full // Should never happen since `batteryMonitoring` is enabled. } UIDevice.current.isBatteryMonitoringEnabled = wasBatteryMonitoringEnabled @@ -768,7 +768,7 @@ extension Device { switch WKInterfaceDevice.current().batteryState { case .charging: self = .charging(batteryLevel) case .full: self = .full - case .unplugged:self = .unplugged(batteryLevel) + case .unplugged: self = .unplugged(batteryLevel) case .unknown: self = .full // Should never happen since `batteryMonitoring` is enabled. } WKInterfaceDevice.current().isBatteryMonitoringEnabled = wasBatteryMonitoringEnabled From 7a5b4e90dbe48b17843353971b5120e45a89493f Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Mon, 4 Mar 2019 19:40:27 +0100 Subject: [PATCH 10/41] Check for current device in isZoomed. --- Source/Device.generated.swift | 5 ++++- Source/Device.swift.gyb | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Source/Device.generated.swift b/Source/Device.generated.swift index 0abaa7a9..22d35b69 100644 --- a/Source/Device.generated.swift +++ b/Source/Device.generated.swift @@ -603,7 +603,10 @@ public enum Device { return Device.realDevice(from: self) } - public var isZoomed: Bool { + public var isZoomed: Bool? { + if !isCurrent { + return nil + } // TODO: Longterm we need a better solution for this! guard self != .iPhoneX && self != .iPhoneXS else { return false } if Int(UIScreen.main.scale.rounded()) == 3 { diff --git a/Source/Device.swift.gyb b/Source/Device.swift.gyb index f975930b..12ef7f39 100644 --- a/Source/Device.swift.gyb +++ b/Source/Device.swift.gyb @@ -449,7 +449,10 @@ public enum Device { return Device.realDevice(from: self) } - public var isZoomed: Bool { + public var isZoomed: Bool? { + if !isCurrent { + return nil + } // TODO: Longterm we need a better solution for this! guard self != .iPhoneX && self != .iPhoneXS else { return false } if Int(UIScreen.main.scale.rounded()) == 3 { From 19cc90f2a47daaa348916183b2ed6507e2e6501c Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Mon, 4 Mar 2019 19:44:05 +0100 Subject: [PATCH 11/41] Add documentation to the isCurrent variable. --- Source/Device.generated.swift | 1 + Source/Device.swift.gyb | 1 + 2 files changed, 2 insertions(+) diff --git a/Source/Device.generated.swift b/Source/Device.generated.swift index 22d35b69..78ade371 100644 --- a/Source/Device.generated.swift +++ b/Source/Device.generated.swift @@ -723,6 +723,7 @@ public enum Device { return devices.contains(self) } + /// Whether or not the current device is the current device. private var isCurrent: Bool { return self == Device.instance } diff --git a/Source/Device.swift.gyb b/Source/Device.swift.gyb index 12ef7f39..5c6022da 100644 --- a/Source/Device.swift.gyb +++ b/Source/Device.swift.gyb @@ -569,6 +569,7 @@ public enum Device { return devices.contains(self) } + /// Whether or not the current device is the current device. private var isCurrent: Bool { return self == Device.instance } From 6d71f313fb0a6b8882281953c3375d758d7c722a Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Mon, 4 Mar 2019 19:44:32 +0100 Subject: [PATCH 12/41] Add static current variable and make the initialiser private. --- Source/Device.generated.swift | 7 ++++++- Source/Device.swift.gyb | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Source/Device.generated.swift b/Source/Device.generated.swift index 78ade371..9ed1b727 100644 --- a/Source/Device.generated.swift +++ b/Source/Device.generated.swift @@ -263,9 +263,14 @@ public enum Device { case unknown(String) /// Initializes a `Device` representing the current device this software runs on. - public init() { + private init() { self = Device.instance } + + /// Return the current device instance. + public static var current: Device { + return Device() + } /// Gets the identifier from the system, such as "iPhone7,1". public static var identifier: String = { diff --git a/Source/Device.swift.gyb b/Source/Device.swift.gyb index 5c6022da..5236d0a9 100644 --- a/Source/Device.swift.gyb +++ b/Source/Device.swift.gyb @@ -234,9 +234,14 @@ public enum Device { case unknown(String) /// Initializes a `Device` representing the current device this software runs on. - public init() { + private init() { self = Device.instance } + + /// Return the current device instance. + public static var current: Device { + return Device() + } /// Gets the identifier from the system, such as "iPhone7,1". public static var identifier: String = { From e72edc5b190511a8fcb686f1cf8f89e89864a0ae Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Mon, 4 Mar 2019 19:51:34 +0100 Subject: [PATCH 13/41] Revert commit used to create the patch branch in my fork. --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index b87e62c5..72e16b55 100644 --- a/README.md +++ b/README.md @@ -219,4 +219,3 @@ If you extended the functionality of DeviceKit yourself and want others to use i ## Contributors The complete list of people who contributed to this project is available [here](https://github.com/dennisweissmann/DeviceKit/graphs/contributors). DeviceKit wouldn't be what it is without you! Thank you very much! 🙏 - From fa6567446563cd8183b0b6c5363d52f102203d0d Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Mon, 4 Mar 2019 19:52:31 +0100 Subject: [PATCH 14/41] Fixed readme so that it also contains the rename of XS and XR. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 72e16b55..fef57d1b 100644 --- a/README.md +++ b/README.md @@ -145,7 +145,7 @@ default: break ### Make Sure the Device Is Contained in a Preconfigured Group ```swift -let groupOfAllowedDevices: [Device] = [.iPhone6, .iPhone6Plus, .iPhone6s, .iPhone6sPlus, .simulator(.iPhone6), .simulator(.iPhone6Plus),.simulator(.iPhone6s),.simulator(.iPhone6sPlus).simulator(.iPhone8),.simulator(.iPhone8Plus),.simulator(.iPhoneX),.simulator(.iPhoneXs),.simulator(.iPhoneXsMax),.simulator(.iPhoneXr)] +let groupOfAllowedDevices: [Device] = [.iPhone6, .iPhone6Plus, .iPhone6s, .iPhone6sPlus, .simulator(.iPhone6), .simulator(.iPhone6Plus),.simulator(.iPhone6s),.simulator(.iPhone6sPlus).simulator(.iPhone8),.simulator(.iPhone8Plus),.simulator(.iPhoneX),.simulator(.iPhoneXS),.simulator(.iPhoneXSMax),.simulator(.iPhoneXR)] let device = Device() From f2145b8fde9f517b8f991000b2b7b53a1332e639 Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Mon, 4 Mar 2019 19:58:43 +0100 Subject: [PATCH 15/41] Check for isCurrent on the isPhone and isPad variables when DeviceKit hasn't been updated for a new device yet. (Fixes https://github.com/dennisweissmann/DeviceKit/issues/165) --- Source/Device.generated.swift | 4 ++-- Source/Device.swift.gyb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Device.generated.swift b/Source/Device.generated.swift index 9ed1b727..ae00a977 100644 --- a/Source/Device.generated.swift +++ b/Source/Device.generated.swift @@ -586,14 +586,14 @@ public enum Device { public var isPhone: Bool { return (isOneOf(Device.allPhones) || isOneOf(Device.allSimulatorPhones) - || UIDevice.current.userInterfaceIdiom == .phone) && !isPod + || (UIDevice.current.userInterfaceIdiom == .phone && isCurrent)) && !isPod } /// Returns whether the device is an iPad (real or simulator) public var isPad: Bool { return isOneOf(Device.allPads) || isOneOf(Device.allSimulatorPads) - || UIDevice.current.userInterfaceIdiom == .pad + || (UIDevice.current.userInterfaceIdiom == .pad && isCurrent) } /// Returns whether the device is any of the simulator diff --git a/Source/Device.swift.gyb b/Source/Device.swift.gyb index 5236d0a9..e79ea235 100644 --- a/Source/Device.swift.gyb +++ b/Source/Device.swift.gyb @@ -432,14 +432,14 @@ public enum Device { public var isPhone: Bool { return (isOneOf(Device.allPhones) || isOneOf(Device.allSimulatorPhones) - || UIDevice.current.userInterfaceIdiom == .phone) && !isPod + || (UIDevice.current.userInterfaceIdiom == .phone && isCurrent)) && !isPod } /// Returns whether the device is an iPad (real or simulator) public var isPad: Bool { return isOneOf(Device.allPads) || isOneOf(Device.allSimulatorPads) - || UIDevice.current.userInterfaceIdiom == .pad + || (UIDevice.current.userInterfaceIdiom == .pad && isCurrent) } /// Returns whether the device is any of the simulator From 32979363568c32ccece997eb157e1cc497515465 Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Tue, 5 Mar 2019 09:03:14 +0100 Subject: [PATCH 16/41] Change device description to use small caps on iPhone XS (Max) and iPhone XR. --- Source/Device.generated.swift | 12 ++++++------ Source/Device.swift.gyb | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Source/Device.generated.swift b/Source/Device.generated.swift index ae00a977..b7ff8347 100644 --- a/Source/Device.generated.swift +++ b/Source/Device.generated.swift @@ -116,15 +116,15 @@ public enum Device { /// /// ![Image](https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP770/iphonex.png) case iPhoneX - /// Device is an [iPhone XS](https://support.apple.com/kb/SP779) + /// Device is an [iPhone Xs](https://support.apple.com/kb/SP779) /// /// ![Image](https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP779/SP779-iphone-xs.jpg) case iPhoneXS - /// Device is an [iPhone XS Max](https://support.apple.com/kb/SP780) + /// Device is an [iPhone Xs Max](https://support.apple.com/kb/SP780) /// /// ![Image](https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP780/SP780-iPhone-Xs-Max.jpg) case iPhoneXSMax - /// Device is an [iPhone XR](https://support.apple.com/kb/SP781) + /// Device is an [iPhone Xʀ](https://support.apple.com/kb/SP781) /// /// ![Image](https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP781/SP781-iPhone-xr.jpg) case iPhoneXR @@ -905,9 +905,9 @@ extension Device: CustomStringConvertible { case .iPhone8: return "iPhone 8" case .iPhone8Plus: return "iPhone 8 Plus" case .iPhoneX: return "iPhone X" - case .iPhoneXS: return "iPhone XS" - case .iPhoneXSMax: return "iPhone XS Max" - case .iPhoneXR: return "iPhone XR" + case .iPhoneXS: return "iPhone Xs" + case .iPhoneXSMax: return "iPhone Xs Max" + case .iPhoneXR: return "iPhone Xʀ" case .iPad2: return "iPad 2" case .iPad3: return "iPad 3" case .iPad4: return "iPad 4" diff --git a/Source/Device.swift.gyb b/Source/Device.swift.gyb index e79ea235..b00b8522 100644 --- a/Source/Device.swift.gyb +++ b/Source/Device.swift.gyb @@ -51,9 +51,9 @@ iPhones = [ Device("iPhone8", "Device is an [iPhone 8](https://support.apple.com/kb/SP767)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP767/iphone8.png", ["iPhone10,1", "iPhone10,4"], 4.7, (9, 16), "iPhone 8", 326, False, False, False, False, True, False, False), Device("iPhone8Plus", "Device is an [iPhone 8 Plus](https://support.apple.com/kb/SP768)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP768/iphone8plus.png", ["iPhone10,2", "iPhone10,5"], 5.5, (9, 16), "iPhone 8 Plus", 401, True, False, False, False, True, False, False), Device("iPhoneX", "Device is an [iPhone X](https://support.apple.com/kb/SP770)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP770/iphonex.png", ["iPhone10,3", "iPhone10,6"], 5.8, (9, 19.5), "iPhone X", 458, False, False, False, True, False, True, True), - Device("iPhoneXS", "Device is an [iPhone XS](https://support.apple.com/kb/SP779)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP779/SP779-iphone-xs.jpg", ["iPhone11,2"], 5.8, (9, 19.5), "iPhone XS", 458, False, False, False, True, False, True, True), - Device("iPhoneXSMax", "Device is an [iPhone XS Max](https://support.apple.com/kb/SP780)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP780/SP780-iPhone-Xs-Max.jpg", ["iPhone11,4", "iPhone11,6"], 6.5, (9, 19.5), "iPhone XS Max", 458, False, False, False, True, False, True, True), - Device("iPhoneXR", "Device is an [iPhone XR](https://support.apple.com/kb/SP781)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP781/SP781-iPhone-xr.jpg", ["iPhone11,8"], 6.1, (9, 19.5), "iPhone XR", 326, False, False, False, True, False, True, True) + Device("iPhoneXS", "Device is an [iPhone Xs](https://support.apple.com/kb/SP779)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP779/SP779-iphone-xs.jpg", ["iPhone11,2"], 5.8, (9, 19.5), "iPhone Xs", 458, False, False, False, True, False, True, True), + Device("iPhoneXSMax", "Device is an [iPhone Xs Max](https://support.apple.com/kb/SP780)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP780/SP780-iPhone-Xs-Max.jpg", ["iPhone11,4", "iPhone11,6"], 6.5, (9, 19.5), "iPhone Xs Max", 458, False, False, False, True, False, True, True), + Device("iPhoneXR", "Device is an [iPhone Xʀ](https://support.apple.com/kb/SP781)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP781/SP781-iPhone-xr.jpg", ["iPhone11,8"], 6.1, (9, 19.5), "iPhone Xʀ", 326, False, False, False, True, False, True, True) ] iPads = [ From d8b5102189b074fd92a9d71fd4402f57bef33858 Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Tue, 5 Mar 2019 09:08:30 +0100 Subject: [PATCH 17/41] Changed all if !isCurrent statements to guards. --- Source/Device.generated.swift | 32 ++++++++------------------------ Source/Device.swift.gyb | 32 ++++++++------------------------ 2 files changed, 16 insertions(+), 48 deletions(-) diff --git a/Source/Device.generated.swift b/Source/Device.generated.swift index b7ff8347..3a94d31a 100644 --- a/Source/Device.generated.swift +++ b/Source/Device.generated.swift @@ -609,9 +609,7 @@ public enum Device { } public var isZoomed: Bool? { - if !isCurrent { - return nil - } + guard isCurrent else { return nil } // TODO: Longterm we need a better solution for this! guard self != .iPhoneX && self != .iPhoneXS else { return false } if Int(UIScreen.main.scale.rounded()) == 3 { @@ -735,9 +733,7 @@ public enum Device { /// The name identifying the device (e.g. "Dennis' iPhone"). public var name: String? { - if !isCurrent { - return nil - } + guard isCurrent else { return nil } #if os(watchOS) return WKInterfaceDevice.current().name #else @@ -747,9 +743,7 @@ public enum Device { /// The name of the operating system running on the device represented by the receiver (e.g. "iOS" or "tvOS"). public var systemName: String? { - if !isCurrent { - return nil - } + guard isCurrent else { return nil } #if os(watchOS) return WKInterfaceDevice.current().systemName #else @@ -759,9 +753,7 @@ public enum Device { /// The current version of the operating system (e.g. 8.4 or 9.2). public var systemVersion: String? { - if !isCurrent { - return nil - } + guard isCurrent else { return nil } #if os(watchOS) return WKInterfaceDevice.current().systemVersion #else @@ -771,9 +763,7 @@ public enum Device { /// The model of the device (e.g. "iPhone" or "iPod Touch"). public var model: String? { - if !isCurrent { - return nil - } + guard isCurrent else { return nil } #if os(watchOS) return WKInterfaceDevice.current().model #else @@ -783,9 +773,7 @@ public enum Device { /// The model of the device as a localized string. public var localizedModel: String? { - if !isCurrent { - return nil - } + guard isCurrent else { return nil } #if os(watchOS) return WKInterfaceDevice.current().localizedModel #else @@ -1049,17 +1037,13 @@ extension Device { /// The state of the battery public var batteryState: BatteryState? { - if !isCurrent { - return nil - } + guard isCurrent else { return nil } return BatteryState() } /// Battery level ranges from 0 (fully discharged) to 100 (100% charged). public var batteryLevel: Int? { - if !isCurrent { - return nil - } + guard isCurrent else { return nil } switch BatteryState() { case .charging(let value): return value case .full: return 100 diff --git a/Source/Device.swift.gyb b/Source/Device.swift.gyb index b00b8522..7227e82b 100644 --- a/Source/Device.swift.gyb +++ b/Source/Device.swift.gyb @@ -455,9 +455,7 @@ public enum Device { } public var isZoomed: Bool? { - if !isCurrent { - return nil - } + guard isCurrent else { return nil } // TODO: Longterm we need a better solution for this! guard self != .iPhoneX && self != .iPhoneXS else { return false } if Int(UIScreen.main.scale.rounded()) == 3 { @@ -581,9 +579,7 @@ public enum Device { /// The name identifying the device (e.g. "Dennis' iPhone"). public var name: String? { - if !isCurrent { - return nil - } + guard isCurrent else { return nil } #if os(watchOS) return WKInterfaceDevice.current().name #else @@ -593,9 +589,7 @@ public enum Device { /// The name of the operating system running on the device represented by the receiver (e.g. "iOS" or "tvOS"). public var systemName: String? { - if !isCurrent { - return nil - } + guard isCurrent else { return nil } #if os(watchOS) return WKInterfaceDevice.current().systemName #else @@ -605,9 +599,7 @@ public enum Device { /// The current version of the operating system (e.g. 8.4 or 9.2). public var systemVersion: String? { - if !isCurrent { - return nil - } + guard isCurrent else { return nil } #if os(watchOS) return WKInterfaceDevice.current().systemVersion #else @@ -617,9 +609,7 @@ public enum Device { /// The model of the device (e.g. "iPhone" or "iPod Touch"). public var model: String? { - if !isCurrent { - return nil - } + guard isCurrent else { return nil } #if os(watchOS) return WKInterfaceDevice.current().model #else @@ -629,9 +619,7 @@ public enum Device { /// The model of the device as a localized string. public var localizedModel: String? { - if !isCurrent { - return nil - } + guard isCurrent else { return nil } #if os(watchOS) return WKInterfaceDevice.current().localizedModel #else @@ -812,17 +800,13 @@ extension Device { /// The state of the battery public var batteryState: BatteryState? { - if !isCurrent { - return nil - } + guard isCurrent else { return nil } return BatteryState() } /// Battery level ranges from 0 (fully discharged) to 100 (100% charged). public var batteryLevel: Int? { - if !isCurrent { - return nil - } + guard isCurrent else { return nil } switch BatteryState() { case .charging(let value): return value case .full: return 100 From 05cac804ca341f442dea9adbc9ca6b6f8afcabab Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Tue, 5 Mar 2019 09:17:06 +0100 Subject: [PATCH 18/41] Remove .instance and the initialiser and completely move over to .current. --- Source/Device.generated.swift | 13 +++---------- Source/Device.swift.gyb | 13 +++---------- 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/Source/Device.generated.swift b/Source/Device.generated.swift index 3a94d31a..d5defe12 100644 --- a/Source/Device.generated.swift +++ b/Source/Device.generated.swift @@ -261,15 +261,10 @@ public enum Device { /// You can still use this enum as before but the description equals the identifier (you can get multiple identifiers for the same product class /// (e.g. "iPhone6,1" or "iPhone 6,2" do both mean "iPhone 5s")) case unknown(String) - - /// Initializes a `Device` representing the current device this software runs on. - private init() { - self = Device.instance - } - /// Return the current device instance. + /// Returns a `Device` representing the current device this software runs on. public static var current: Device { - return Device() + return Device.mapToDevice(identifier: Device.identifier) } /// Gets the identifier from the system, such as "iPhone7,1". @@ -285,8 +280,6 @@ public enum Device { return identifier }() - private static let instance = Device.mapToDevice(identifier: Device.identifier) - /// Maps an identifier to a Device. If the identifier can not be mapped to an existing device, `UnknownDevice(identifier)` is returned. /// /// - parameter identifier: The device identifier, e.g. "iPhone7,1". Can be obtained from `Device.identifier`. @@ -728,7 +721,7 @@ public enum Device { /// Whether or not the current device is the current device. private var isCurrent: Bool { - return self == Device.instance + return self == Device.current } /// The name identifying the device (e.g. "Dennis' iPhone"). diff --git a/Source/Device.swift.gyb b/Source/Device.swift.gyb index 7227e82b..fdbbb9fc 100644 --- a/Source/Device.swift.gyb +++ b/Source/Device.swift.gyb @@ -232,15 +232,10 @@ public enum Device { /// You can still use this enum as before but the description equals the identifier (you can get multiple identifiers for the same product class /// (e.g. "iPhone6,1" or "iPhone 6,2" do both mean "iPhone 5s")) case unknown(String) - - /// Initializes a `Device` representing the current device this software runs on. - private init() { - self = Device.instance - } - /// Return the current device instance. + /// Returns a `Device` representing the current device this software runs on. public static var current: Device { - return Device() + return Device.mapToDevice(identifier: Device.identifier) } /// Gets the identifier from the system, such as "iPhone7,1". @@ -256,8 +251,6 @@ public enum Device { return identifier }() - private static let instance = Device.mapToDevice(identifier: Device.identifier) - /// Maps an identifier to a Device. If the identifier can not be mapped to an existing device, `UnknownDevice(identifier)` is returned. /// /// - parameter identifier: The device identifier, e.g. "iPhone7,1". Can be obtained from `Device.identifier`. @@ -574,7 +567,7 @@ public enum Device { /// Whether or not the current device is the current device. private var isCurrent: Bool { - return self == Device.instance + return self == Device.current } /// The name identifying the device (e.g. "Dennis' iPhone"). From 463b70830bf85a3153944deaa7f80ba3319550d6 Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Tue, 5 Mar 2019 11:03:03 +0100 Subject: [PATCH 19/41] Fixed names of iPad 3, 4, 5 and 6. --- Source/Device.generated.swift | 12 ++++++------ Source/Device.swift.gyb | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Source/Device.generated.swift b/Source/Device.generated.swift index d5defe12..db36efd7 100644 --- a/Source/Device.generated.swift +++ b/Source/Device.generated.swift @@ -148,11 +148,11 @@ public enum Device { /// /// ![Image](https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP708/SP708-space_gray.jpeg) case iPadAir2 - /// Device is an [iPad 5](https://support.apple.com/kb/SP751) + /// Device is an [iPad (5th generation)](https://support.apple.com/kb/SP751) /// /// ![Image](https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP751/ipad_5th_generation.png) case iPad5 - /// Device is an [iPad 6](https://support.apple.com/kb/NotYetAvailable) + /// Device is an [iPad (6th generation)](https://support.apple.com/kb/NotYetAvailable) /// /// ![Image](https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP751/ipad_5th_generation.png) case iPad6 @@ -890,12 +890,12 @@ extension Device: CustomStringConvertible { case .iPhoneXSMax: return "iPhone Xs Max" case .iPhoneXR: return "iPhone Xʀ" case .iPad2: return "iPad 2" - case .iPad3: return "iPad 3" - case .iPad4: return "iPad 4" + case .iPad3: return "iPad (3rd generation)" + case .iPad4: return "iPad (4th generation)" case .iPadAir: return "iPad Air" case .iPadAir2: return "iPad Air 2" - case .iPad5: return "iPad 5" - case .iPad6: return "iPad 6" + case .iPad5: return "iPad (5th generation)" + case .iPad6: return "iPad (6th generation)" case .iPadMini: return "iPad Mini" case .iPadMini2: return "iPad Mini 2" case .iPadMini3: return "iPad Mini 3" diff --git a/Source/Device.swift.gyb b/Source/Device.swift.gyb index fdbbb9fc..2fac58f9 100644 --- a/Source/Device.swift.gyb +++ b/Source/Device.swift.gyb @@ -58,12 +58,12 @@ iPhones = [ iPads = [ Device("iPad2", "Device is an [iPad 2](https://support.apple.com/kb/SP622)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP622/SP622_01-ipad2-mul.png", ["iPad2,1", "iPad2,2", "iPad2,3", "iPad2,4"], 9.7, (3, 4), "iPad 2", 132, False, False, False, False, False, False, False), - Device("iPad3", "Device is an [iPad (3rd generation)](https://support.apple.com/kb/SP647)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP662/sp662_ipad-4th-gen_color.jpg", ["iPad3,1", "iPad3,2", "iPad3,3"], 9.7, (3, 4), "iPad 3", 264, False, False, False, False, False, False, False), - Device("iPad4", "Device is an [iPad (4th generation)](https://support.apple.com/kb/SP662)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP662/sp662_ipad-4th-gen_color.jpg", ["iPad3,4", "iPad3,5", "iPad3,6"], 9.7, (3, 4), "iPad 4", 264, False, False, False, False, False, False, False), + Device("iPad3", "Device is an [iPad (3rd generation)](https://support.apple.com/kb/SP647)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP662/sp662_ipad-4th-gen_color.jpg", ["iPad3,1", "iPad3,2", "iPad3,3"], 9.7, (3, 4), "iPad (3rd generation)", 264, False, False, False, False, False, False, False), + Device("iPad4", "Device is an [iPad (4th generation)](https://support.apple.com/kb/SP662)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP662/sp662_ipad-4th-gen_color.jpg", ["iPad3,4", "iPad3,5", "iPad3,6"], 9.7, (3, 4), "iPad (4th generation)", 264, False, False, False, False, False, False, False), Device("iPadAir", "Device is an [iPad Air](https://support.apple.com/kb/SP692)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP692/SP692-specs_color-mul.png", ["iPad4,1", "iPad4,2", "iPad4,3"], 9.7, (3, 4), "iPad Air", 264, False, False, False, False, False, False, False), Device("iPadAir2", "Device is an [iPad Air 2](https://support.apple.com/kb/SP708)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP708/SP708-space_gray.jpeg", ["iPad5,3", "iPad5,4"], 9.7, (3, 4), "iPad Air 2", 264, False, False, False, False, True, False, False), - Device("iPad5", "Device is an [iPad 5](https://support.apple.com/kb/SP751)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP751/ipad_5th_generation.png", ["iPad6,11", "iPad6,12"], 9.7, (3, 4), "iPad 5", 264, False, False, False, False, True, False, False), - Device("iPad6", "Device is an [iPad 6](https://support.apple.com/kb/NotYetAvailable)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP751/ipad_5th_generation.png", ["iPad7,5", "iPad7,6"], 9.7, (3, 4), "iPad 6", 264, False, False, False, False, True, False, False), + Device("iPad5", "Device is an [iPad (5th generation)](https://support.apple.com/kb/SP751)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP751/ipad_5th_generation.png", ["iPad6,11", "iPad6,12"], 9.7, (3, 4), "iPad (5th generation)", 264, False, False, False, False, True, False, False), + Device("iPad6", "Device is an [iPad (6th generation)](https://support.apple.com/kb/NotYetAvailable)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP751/ipad_5th_generation.png", ["iPad7,5", "iPad7,6"], 9.7, (3, 4), "iPad (6th generation)", 264, False, False, False, False, True, False, False), Device("iPadMini", "Device is an [iPad Mini](https://support.apple.com/kb/SP661)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP661/sp661_ipad_mini_color.jpg", ["iPad2,5", "iPad2,6", "iPad2,7"], 7.9, (3, 4), "iPad Mini", 163, False, True, False, False, False, False, False), Device("iPadMini2", "Device is an [iPad Mini 2](https://support.apple.com/kb/SP693)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP693/SP693-specs_color-mul.png", ["iPad4,4", "iPad4,5", "iPad4,6"], 7.9, (3, 4), "iPad Mini 2", 326, False, True, False, False, False, False, False), Device("iPadMini3", "Device is an [iPad Mini 3](https://support.apple.com/kb/SP709)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP709/SP709-space_gray.jpeg", ["iPad4,7", "iPad4,8", "iPad4,9"], 7.9, (3, 4), "iPad Mini 3", 326, False, True, False, False, True, False, False), From c834fe5a12cb0400135d43d1dc9e0391d1fbd6ae Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Mon, 18 Mar 2019 09:29:12 +0100 Subject: [PATCH 20/41] Fix https://github.com/dennisweissmann/DeviceKit/pull/166 not being added through the gyb file. --- Source/Device.generated.swift | 12 +++- Source/Device.swift.gyb | 115 +++++++++++++++++++--------------- 2 files changed, 74 insertions(+), 53 deletions(-) diff --git a/Source/Device.generated.swift b/Source/Device.generated.swift index db36efd7..1fae2df0 100644 --- a/Source/Device.generated.swift +++ b/Source/Device.generated.swift @@ -637,7 +637,7 @@ public enum Device { public var hasBiometricSensor: Bool { return isTouchIDCapable || isFaceIDCapable } - + /// All devices that feature a sensor housing in the screen public static var allDevicesWithSensorHousing: [Device] { return [.iPhoneX, .iPhoneXS, .iPhoneXSMax, .iPhoneXR] @@ -648,6 +648,16 @@ public enum Device { return isOneOf(Device.allDevicesWithSensorHousing) } + /// All devices that feature a screen with rounded corners. + public static var allDevicesWithRoundedDisplayCorners: [Device] { + return [.iPhoneX, .iPhoneXS, .iPhoneXSMax, .iPhoneXR, .iPadPro11Inch, .iPadPro12Inch3] + } + + /// Returns whether or not the device has a screen with rounded corners. + public var hasRoundedDisplayCorners: Bool { + return isOneOf(Device.allDevicesWithRoundedDisplayCorners) + } + #elseif os(tvOS) /// All TVs public static var allTVs: [Device] { diff --git a/Source/Device.swift.gyb b/Source/Device.swift.gyb index 2fac58f9..967497e9 100644 --- a/Source/Device.swift.gyb +++ b/Source/Device.swift.gyb @@ -12,7 +12,7 @@ %{ class Device: - def __init__(self, caseName, comment, imageURL, identifiers, diagonal, screenRatio, description, ppi, isPlusFormFactor, isPadMiniFormFactor, isPro, isXSeries, hasTouchID, hasFaceID, hasSensorHousing): + def __init__(self, caseName, comment, imageURL, identifiers, diagonal, screenRatio, description, ppi, isPlusFormFactor, isPadMiniFormFactor, isPro, isXSeries, hasTouchID, hasFaceID, hasSensorHousing, hasRoundedDisplayCorners): self.caseName = caseName self.comment = comment self.imageURL = imageURL @@ -28,62 +28,63 @@ class Device: self.hasTouchID = hasTouchID self.hasFaceID = hasFaceID self.hasSensorHousing = hasSensorHousing + self.hasRoundedDisplayCorners = hasRoundedDisplayCorners # iOS iPods = [ - Device("iPodTouch5", "Device is an [iPod Touch (5th generation)](https://support.apple.com/kb/SP657)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP657/sp657_ipod-touch_size.jpg", ["iPod5,1"], 4, (9, 16), "iPod Touch 5", 326, False, False, False, False, False, False, False), - Device("iPodTouch6", "Device is an [iPod Touch (6th generation)](https://support.apple.com/kb/SP720)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP720/SP720-ipod-touch-specs-color-sg-2015.jpg", ["iPod7,1"], 4, (9, 16), "iPod Touch 6", 326, False, False, False, False, False, False, False) + Device("iPodTouch5", "Device is an [iPod Touch (5th generation)](https://support.apple.com/kb/SP657)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP657/sp657_ipod-touch_size.jpg", ["iPod5,1"], 4, (9, 16), "iPod Touch 5", 326, False, False, False, False, False, False, False, False), + Device("iPodTouch6", "Device is an [iPod Touch (6th generation)](https://support.apple.com/kb/SP720)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP720/SP720-ipod-touch-specs-color-sg-2015.jpg", ["iPod7,1"], 4, (9, 16), "iPod Touch 6", 326, False, False, False, False, False, False, False, False) ] iPhones = [ - Device("iPhone4", "Device is an [iPhone 4](https://support.apple.com/kb/SP587)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP643/sp643_iphone4s_color_black.jpg", ["iPhone3,1", "iPhone3,2", "iPhone3,3"], 3.5, (2, 3), "iPhone 4", 326, False, False, False, False, False, False, False), - Device("iPhone4s", "Device is an [iPhone 4s](https://support.apple.com/kb/SP643)", "https://support.apple.com/library/content/dam/edam/applecare/images/en_US/iphone/iphone5s/iphone_4s.png", ["iPhone4,1"], 3.5, (2, 3), "iPhone 4s", 326, False, False, False, False, False, False, False), - Device("iPhone5", "Device is an [iPhone 5](https://support.apple.com/kb/SP655)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP655/sp655_iphone5_color.jpg", ["iPhone5,1", "iPhone5,2"], 4, (9, 16), "iPhone 5", 326, False, False, False, False, False, False, False), - Device("iPhone5c", "Device is an [iPhone 5c](https://support.apple.com/kb/SP684)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP684/SP684-color_yellow.jpg", ["iPhone5,3", "iPhone5,4"], 4, (9, 16), "iPhone 5c", 326, False, False, False, False, False, False, False), - Device("iPhone5s", "Device is an [iPhone 5s](https://support.apple.com/kb/SP685)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP685/SP685-color_black.jpg", ["iPhone6,1", "iPhone6,2"], 4, (9, 16), "iPhone 5s", 326, False, False, False, False, True, False, False), - Device("iPhone6", "Device is an [iPhone 6](https://support.apple.com/kb/SP705)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP705/SP705-iphone_6-mul.png", ["iPhone7,2"], 4.7, (9, 16), "iPhone 6", 326, False, False, False, False, True, False, False), - Device("iPhone6Plus", "Device is an [iPhone 6 Plus](https://support.apple.com/kb/SP706)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP706/SP706-iphone_6_plus-mul.png", ["iPhone7,1"], 5.5, (9, 16), "iPhone 6 Plus", 401, True, False, False, False, True, False, False), - Device("iPhone6s", "Device is an [iPhone 6s](https://support.apple.com/kb/SP726)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP726/SP726-iphone6s-gray-select-2015.png", ["iPhone8,1"], 4.7, (9, 16), "iPhone 6s", 326, False, False, False, False, True, False, False), - Device("iPhone6sPlus", "Device is an [iPhone 6s Plus](https://support.apple.com/kb/SP727)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP727/SP727-iphone6s-plus-gray-select-2015.png", ["iPhone8,2"], 5.5, (9, 16), "iPhone 6s Plus", 401, True, False, False, False, True, False, False), - Device("iPhone7", "Device is an [iPhone 7](https://support.apple.com/kb/SP743)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP743/iphone7-black.png", ["iPhone9,1", "iPhone9,3"], 4.7, (9, 16), "iPhone 7", 326, False, False, False, False, True, False, False), - Device("iPhone7Plus", "Device is an [iPhone 7 Plus](https://support.apple.com/kb/SP744)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP744/iphone7-plus-black.png", ["iPhone9,2", "iPhone9,4"], 5.5, (9, 16), "iPhone 7 Plus", 401, True, False, False, False, True, False, False), - Device("iPhoneSE", "Device is an [iPhone SE](https://support.apple.com/kb/SP738)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP738/SP738.png", ["iPhone8,4"], 4, (9, 16), "iPhone SE", 326, False, False, False, False, True, False, False), - Device("iPhone8", "Device is an [iPhone 8](https://support.apple.com/kb/SP767)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP767/iphone8.png", ["iPhone10,1", "iPhone10,4"], 4.7, (9, 16), "iPhone 8", 326, False, False, False, False, True, False, False), - Device("iPhone8Plus", "Device is an [iPhone 8 Plus](https://support.apple.com/kb/SP768)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP768/iphone8plus.png", ["iPhone10,2", "iPhone10,5"], 5.5, (9, 16), "iPhone 8 Plus", 401, True, False, False, False, True, False, False), - Device("iPhoneX", "Device is an [iPhone X](https://support.apple.com/kb/SP770)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP770/iphonex.png", ["iPhone10,3", "iPhone10,6"], 5.8, (9, 19.5), "iPhone X", 458, False, False, False, True, False, True, True), - Device("iPhoneXS", "Device is an [iPhone Xs](https://support.apple.com/kb/SP779)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP779/SP779-iphone-xs.jpg", ["iPhone11,2"], 5.8, (9, 19.5), "iPhone Xs", 458, False, False, False, True, False, True, True), - Device("iPhoneXSMax", "Device is an [iPhone Xs Max](https://support.apple.com/kb/SP780)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP780/SP780-iPhone-Xs-Max.jpg", ["iPhone11,4", "iPhone11,6"], 6.5, (9, 19.5), "iPhone Xs Max", 458, False, False, False, True, False, True, True), - Device("iPhoneXR", "Device is an [iPhone Xʀ](https://support.apple.com/kb/SP781)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP781/SP781-iPhone-xr.jpg", ["iPhone11,8"], 6.1, (9, 19.5), "iPhone Xʀ", 326, False, False, False, True, False, True, True) + Device("iPhone4", "Device is an [iPhone 4](https://support.apple.com/kb/SP587)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP643/sp643_iphone4s_color_black.jpg", ["iPhone3,1", "iPhone3,2", "iPhone3,3"], 3.5, (2, 3), "iPhone 4", 326, False, False, False, False, False, False, False, False), + Device("iPhone4s", "Device is an [iPhone 4s](https://support.apple.com/kb/SP643)", "https://support.apple.com/library/content/dam/edam/applecare/images/en_US/iphone/iphone5s/iphone_4s.png", ["iPhone4,1"], 3.5, (2, 3), "iPhone 4s", 326, False, False, False, False, False, False, False, False), + Device("iPhone5", "Device is an [iPhone 5](https://support.apple.com/kb/SP655)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP655/sp655_iphone5_color.jpg", ["iPhone5,1", "iPhone5,2"], 4, (9, 16), "iPhone 5", 326, False, False, False, False, False, False, False, False), + Device("iPhone5c", "Device is an [iPhone 5c](https://support.apple.com/kb/SP684)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP684/SP684-color_yellow.jpg", ["iPhone5,3", "iPhone5,4"], 4, (9, 16), "iPhone 5c", 326, False, False, False, False, False, False, False, False), + Device("iPhone5s", "Device is an [iPhone 5s](https://support.apple.com/kb/SP685)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP685/SP685-color_black.jpg", ["iPhone6,1", "iPhone6,2"], 4, (9, 16), "iPhone 5s", 326, False, False, False, False, True, False, False, False), + Device("iPhone6", "Device is an [iPhone 6](https://support.apple.com/kb/SP705)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP705/SP705-iphone_6-mul.png", ["iPhone7,2"], 4.7, (9, 16), "iPhone 6", 326, False, False, False, False, True, False, False, False), + Device("iPhone6Plus", "Device is an [iPhone 6 Plus](https://support.apple.com/kb/SP706)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP706/SP706-iphone_6_plus-mul.png", ["iPhone7,1"], 5.5, (9, 16), "iPhone 6 Plus", 401, True, False, False, False, True, False, False, False), + Device("iPhone6s", "Device is an [iPhone 6s](https://support.apple.com/kb/SP726)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP726/SP726-iphone6s-gray-select-2015.png", ["iPhone8,1"], 4.7, (9, 16), "iPhone 6s", 326, False, False, False, False, True, False, False, False), + Device("iPhone6sPlus", "Device is an [iPhone 6s Plus](https://support.apple.com/kb/SP727)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP727/SP727-iphone6s-plus-gray-select-2015.png", ["iPhone8,2"], 5.5, (9, 16), "iPhone 6s Plus", 401, True, False, False, False, True, False, False, False), + Device("iPhone7", "Device is an [iPhone 7](https://support.apple.com/kb/SP743)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP743/iphone7-black.png", ["iPhone9,1", "iPhone9,3"], 4.7, (9, 16), "iPhone 7", 326, False, False, False, False, True, False, False, False), + Device("iPhone7Plus", "Device is an [iPhone 7 Plus](https://support.apple.com/kb/SP744)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP744/iphone7-plus-black.png", ["iPhone9,2", "iPhone9,4"], 5.5, (9, 16), "iPhone 7 Plus", 401, True, False, False, False, True, False, False, False), + Device("iPhoneSE", "Device is an [iPhone SE](https://support.apple.com/kb/SP738)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP738/SP738.png", ["iPhone8,4"], 4, (9, 16), "iPhone SE", 326, False, False, False, False, True, False, False, False), + Device("iPhone8", "Device is an [iPhone 8](https://support.apple.com/kb/SP767)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP767/iphone8.png", ["iPhone10,1", "iPhone10,4"], 4.7, (9, 16), "iPhone 8", 326, False, False, False, False, True, False, False, False), + Device("iPhone8Plus", "Device is an [iPhone 8 Plus](https://support.apple.com/kb/SP768)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP768/iphone8plus.png", ["iPhone10,2", "iPhone10,5"], 5.5, (9, 16), "iPhone 8 Plus", 401, True, False, False, False, True, False, False, False), + Device("iPhoneX", "Device is an [iPhone X](https://support.apple.com/kb/SP770)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP770/iphonex.png", ["iPhone10,3", "iPhone10,6"], 5.8, (9, 19.5), "iPhone X", 458, False, False, False, True, False, True, True, True), + Device("iPhoneXS", "Device is an [iPhone Xs](https://support.apple.com/kb/SP779)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP779/SP779-iphone-xs.jpg", ["iPhone11,2"], 5.8, (9, 19.5), "iPhone Xs", 458, False, False, False, True, False, True, True, True), + Device("iPhoneXSMax", "Device is an [iPhone Xs Max](https://support.apple.com/kb/SP780)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP780/SP780-iPhone-Xs-Max.jpg", ["iPhone11,4", "iPhone11,6"], 6.5, (9, 19.5), "iPhone Xs Max", 458, False, False, False, True, False, True, True, True), + Device("iPhoneXR", "Device is an [iPhone Xʀ](https://support.apple.com/kb/SP781)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP781/SP781-iPhone-xr.jpg", ["iPhone11,8"], 6.1, (9, 19.5), "iPhone Xʀ", 326, False, False, False, True, False, True, True, True) ] iPads = [ - Device("iPad2", "Device is an [iPad 2](https://support.apple.com/kb/SP622)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP622/SP622_01-ipad2-mul.png", ["iPad2,1", "iPad2,2", "iPad2,3", "iPad2,4"], 9.7, (3, 4), "iPad 2", 132, False, False, False, False, False, False, False), - Device("iPad3", "Device is an [iPad (3rd generation)](https://support.apple.com/kb/SP647)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP662/sp662_ipad-4th-gen_color.jpg", ["iPad3,1", "iPad3,2", "iPad3,3"], 9.7, (3, 4), "iPad (3rd generation)", 264, False, False, False, False, False, False, False), - Device("iPad4", "Device is an [iPad (4th generation)](https://support.apple.com/kb/SP662)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP662/sp662_ipad-4th-gen_color.jpg", ["iPad3,4", "iPad3,5", "iPad3,6"], 9.7, (3, 4), "iPad (4th generation)", 264, False, False, False, False, False, False, False), - Device("iPadAir", "Device is an [iPad Air](https://support.apple.com/kb/SP692)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP692/SP692-specs_color-mul.png", ["iPad4,1", "iPad4,2", "iPad4,3"], 9.7, (3, 4), "iPad Air", 264, False, False, False, False, False, False, False), - Device("iPadAir2", "Device is an [iPad Air 2](https://support.apple.com/kb/SP708)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP708/SP708-space_gray.jpeg", ["iPad5,3", "iPad5,4"], 9.7, (3, 4), "iPad Air 2", 264, False, False, False, False, True, False, False), - Device("iPad5", "Device is an [iPad (5th generation)](https://support.apple.com/kb/SP751)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP751/ipad_5th_generation.png", ["iPad6,11", "iPad6,12"], 9.7, (3, 4), "iPad (5th generation)", 264, False, False, False, False, True, False, False), - Device("iPad6", "Device is an [iPad (6th generation)](https://support.apple.com/kb/NotYetAvailable)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP751/ipad_5th_generation.png", ["iPad7,5", "iPad7,6"], 9.7, (3, 4), "iPad (6th generation)", 264, False, False, False, False, True, False, False), - Device("iPadMini", "Device is an [iPad Mini](https://support.apple.com/kb/SP661)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP661/sp661_ipad_mini_color.jpg", ["iPad2,5", "iPad2,6", "iPad2,7"], 7.9, (3, 4), "iPad Mini", 163, False, True, False, False, False, False, False), - Device("iPadMini2", "Device is an [iPad Mini 2](https://support.apple.com/kb/SP693)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP693/SP693-specs_color-mul.png", ["iPad4,4", "iPad4,5", "iPad4,6"], 7.9, (3, 4), "iPad Mini 2", 326, False, True, False, False, False, False, False), - Device("iPadMini3", "Device is an [iPad Mini 3](https://support.apple.com/kb/SP709)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP709/SP709-space_gray.jpeg", ["iPad4,7", "iPad4,8", "iPad4,9"], 7.9, (3, 4), "iPad Mini 3", 326, False, True, False, False, True, False, False), - Device("iPadMini4", "Device is an [iPad Mini 4](https://support.apple.com/kb/SP725)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP725/SP725ipad-mini-4.png", ["iPad5,1", "iPad5,2"], 7.9, (3, 4), "iPad Mini 4", 326, False, True, False, False, True, False, False), - Device("iPadPro9Inch", "Device is an [iPad Pro 9.7-inch](https://support.apple.com/kb/SP739)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP739/SP739.png", ["iPad6,3", "iPad6,4"], 9.7, (3, 4), "iPad Pro (9.7-inch)", 264, False, False, True, False, True, False, False), - Device("iPadPro12Inch", "Device is an [iPad Pro 12-inch](https://support.apple.com/kb/sp723)", "http://images.apple.com/v/ipad-pro/c/images/shared/buystrip/ipad_pro_large_2x.png", ["iPad6,7", "iPad6,8"], 12.9, (3, 4), "iPad Pro (12.9-inch)", 264, False, False, True, False, True, False, False), - Device("iPadPro12Inch2", "Device is an [iPad Pro 12-inch (2nd generation)](https://support.apple.com/kb/SP761)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP761/ipad-pro-12in-hero-201706.png", ["iPad7,1", "iPad7,2"], 12.9, (3, 4), "iPad Pro (12.9-inch) (2nd generation)", 264, False, False, True, False, True, False, False), - Device("iPadPro10Inch", "Device is an [iPad Pro 10.5-inch](https://support.apple.com/kb/SP762)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP761/ipad-pro-10in-hero-201706.png", ["iPad7,3", "iPad7,4"], 10.5, (3, 4), "iPad Pro (10.5-inch)", 264, False, False, True, False, True, False, False), - Device("iPadPro11Inch", "Device is an [iPad Pro 11-inch](https://support.apple.com/kb/not-published-yet)", "https://support.apple.com/not-published-yet", ["iPad8,1", "iPad8,2", "iPad8,3", "iPad8,4"], 11.0, (139, 199), "iPad Pro (11-inch)", 264, False, False, True, False, False, True, False), - Device("iPadPro12Inch3", "Device is an [iPad Pro 12.9-inch (3rd generation)](https://support.apple.com/kb/not-published-yet)", "https://support.apple.com/not-published-yet", ["iPad8,5", "iPad8,6", "iPad8,7", "iPad8,8"], 12.9, (512, 683), "iPad Pro (12.9-inch) (3rd generation)", 264, False, False, True, False, False, True, False) + Device("iPad2", "Device is an [iPad 2](https://support.apple.com/kb/SP622)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP622/SP622_01-ipad2-mul.png", ["iPad2,1", "iPad2,2", "iPad2,3", "iPad2,4"], 9.7, (3, 4), "iPad 2", 132, False, False, False, False, False, False, False, False), + Device("iPad3", "Device is an [iPad (3rd generation)](https://support.apple.com/kb/SP647)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP662/sp662_ipad-4th-gen_color.jpg", ["iPad3,1", "iPad3,2", "iPad3,3"], 9.7, (3, 4), "iPad (3rd generation)", 264, False, False, False, False, False, False, False, False), + Device("iPad4", "Device is an [iPad (4th generation)](https://support.apple.com/kb/SP662)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP662/sp662_ipad-4th-gen_color.jpg", ["iPad3,4", "iPad3,5", "iPad3,6"], 9.7, (3, 4), "iPad (4th generation)", 264, False, False, False, False, False, False, False, False), + Device("iPadAir", "Device is an [iPad Air](https://support.apple.com/kb/SP692)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP692/SP692-specs_color-mul.png", ["iPad4,1", "iPad4,2", "iPad4,3"], 9.7, (3, 4), "iPad Air", 264, False, False, False, False, False, False, False, False), + Device("iPadAir2", "Device is an [iPad Air 2](https://support.apple.com/kb/SP708)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP708/SP708-space_gray.jpeg", ["iPad5,3", "iPad5,4"], 9.7, (3, 4), "iPad Air 2", 264, False, False, False, False, True, False, False, False), + Device("iPad5", "Device is an [iPad (5th generation)](https://support.apple.com/kb/SP751)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP751/ipad_5th_generation.png", ["iPad6,11", "iPad6,12"], 9.7, (3, 4), "iPad (5th generation)", 264, False, False, False, False, True, False, False, False), + Device("iPad6", "Device is an [iPad (6th generation)](https://support.apple.com/kb/NotYetAvailable)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP751/ipad_5th_generation.png", ["iPad7,5", "iPad7,6"], 9.7, (3, 4), "iPad (6th generation)", 264, False, False, False, False, True, False, False, False), + Device("iPadMini", "Device is an [iPad Mini](https://support.apple.com/kb/SP661)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP661/sp661_ipad_mini_color.jpg", ["iPad2,5", "iPad2,6", "iPad2,7"], 7.9, (3, 4), "iPad Mini", 163, False, True, False, False, False, False, False, False), + Device("iPadMini2", "Device is an [iPad Mini 2](https://support.apple.com/kb/SP693)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP693/SP693-specs_color-mul.png", ["iPad4,4", "iPad4,5", "iPad4,6"], 7.9, (3, 4), "iPad Mini 2", 326, False, True, False, False, False, False, False, False), + Device("iPadMini3", "Device is an [iPad Mini 3](https://support.apple.com/kb/SP709)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP709/SP709-space_gray.jpeg", ["iPad4,7", "iPad4,8", "iPad4,9"], 7.9, (3, 4), "iPad Mini 3", 326, False, True, False, False, True, False, False, False), + Device("iPadMini4", "Device is an [iPad Mini 4](https://support.apple.com/kb/SP725)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP725/SP725ipad-mini-4.png", ["iPad5,1", "iPad5,2"], 7.9, (3, 4), "iPad Mini 4", 326, False, True, False, False, True, False, False, False), + Device("iPadPro9Inch", "Device is an [iPad Pro 9.7-inch](https://support.apple.com/kb/SP739)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP739/SP739.png", ["iPad6,3", "iPad6,4"], 9.7, (3, 4), "iPad Pro (9.7-inch)", 264, False, False, True, False, True, False, False, False), + Device("iPadPro12Inch", "Device is an [iPad Pro 12-inch](https://support.apple.com/kb/sp723)", "http://images.apple.com/v/ipad-pro/c/images/shared/buystrip/ipad_pro_large_2x.png", ["iPad6,7", "iPad6,8"], 12.9, (3, 4), "iPad Pro (12.9-inch)", 264, False, False, True, False, True, False, False, False), + Device("iPadPro12Inch2", "Device is an [iPad Pro 12-inch (2nd generation)](https://support.apple.com/kb/SP761)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP761/ipad-pro-12in-hero-201706.png", ["iPad7,1", "iPad7,2"], 12.9, (3, 4), "iPad Pro (12.9-inch) (2nd generation)", 264, False, False, True, False, True, False, False, False), + Device("iPadPro10Inch", "Device is an [iPad Pro 10.5-inch](https://support.apple.com/kb/SP762)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP761/ipad-pro-10in-hero-201706.png", ["iPad7,3", "iPad7,4"], 10.5, (3, 4), "iPad Pro (10.5-inch)", 264, False, False, True, False, True, False, False, False), + Device("iPadPro11Inch", "Device is an [iPad Pro 11-inch](https://support.apple.com/kb/not-published-yet)", "https://support.apple.com/not-published-yet", ["iPad8,1", "iPad8,2", "iPad8,3", "iPad8,4"], 11.0, (139, 199), "iPad Pro (11-inch)", 264, False, False, True, False, False, True, False, True), + Device("iPadPro12Inch3", "Device is an [iPad Pro 12.9-inch (3rd generation)](https://support.apple.com/kb/not-published-yet)", "https://support.apple.com/not-published-yet", ["iPad8,5", "iPad8,6", "iPad8,7", "iPad8,8"], 12.9, (512, 683), "iPad Pro (12.9-inch) (3rd generation)", 264, False, False, True, False, False, True, False, True) ] homePods = [ - Device("homePod", "Device is a [HomePod](https://www.apple.com/homepod/)", "https://images.apple.com/v/homepod/d/images/overview/homepod_side_dark_large_2x.jpg", ["AudioAccessory1,1"], -1, (4, 5), "HomePod", -1, False, False, False, False, False, False, False), + Device("homePod", "Device is a [HomePod](https://www.apple.com/homepod/)", "https://images.apple.com/v/homepod/d/images/overview/homepod_side_dark_large_2x.jpg", ["AudioAccessory1,1"], -1, (4, 5), "HomePod", -1, False, False, False, False, False, False, False, False), ] # tvOS tvs = [ - Device("appleTV4", "Device is an [Apple TV 4](https://support.apple.com/kb/SP724)", "http://images.apple.com/v/tv/c/images/overview/buy_tv_large_2x.jpg", ["AppleTV5,3"], 0, (), "Apple TV 4", -1, False, False, False, False, False, False, False), - Device("appleTV4K", "Device is an [Apple TV 4K](https://support.apple.com/kb/SP769)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP769/appletv4k.png", ["AppleTV6,2"], 0, (), "Apple TV 4K", -1, False, False, False, False, False, False, False) + Device("appleTV4", "Device is an [Apple TV 4](https://support.apple.com/kb/SP724)", "http://images.apple.com/v/tv/c/images/overview/buy_tv_large_2x.jpg", ["AppleTV5,3"], 0, (), "Apple TV 4", -1, False, False, False, False, False, False, False, False), + Device("appleTV4K", "Device is an [Apple TV 4K](https://support.apple.com/kb/SP769)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP769/appletv4k.png", ["AppleTV6,2"], 0, (), "Apple TV 4K", -1, False, False, False, False, False, False, False, False) ] # watchOS @@ -92,70 +93,70 @@ watches = [ "appleWatchSeries0_38mm", "Device is an [Apple Watch (1st generation)](https://support.apple.com/kb/SP735)", "https://km.support.apple.com/resources/sites/APPLE/content/live/IMAGES/0/IM784/en_US/apple_watch_sport-240.png", - ["Watch1,1"], 1.5, (4,5), "Apple Watch (1st generation) 38mm", 290, False, False, False, False, False, False, False), + ["Watch1,1"], 1.5, (4,5), "Apple Watch (1st generation) 38mm", 290, False, False, False, False, False, False, False, False), Device( "appleWatchSeries0_42mm", "Device is an [Apple Watch (1st generation)](https://support.apple.com/kb/SP735)", "https://km.support.apple.com/resources/sites/APPLE/content/live/IMAGES/0/IM784/en_US/apple_watch_sport-240.png", - ["Watch1,2"], 1.6, (4,5), "Apple Watch (1st generation) 42mm", 303, False, False, False, False, False, False, False), + ["Watch1,2"], 1.6, (4,5), "Apple Watch (1st generation) 42mm", 303, False, False, False, False, False, False, False, False), Device( "appleWatchSeries1_38mm", "Device is an [Apple Watch Series 1](https://support.apple.com/kb/SP745)", "https://km.support.apple.com/resources/sites/APPLE/content/live/IMAGES/0/IM848/en_US/applewatch-series2-aluminum-temp-240.png", - ["Watch2,6"], 1.5, (4,5), "Apple Watch Series 1 38mm", 290, False, False, False, False, False, False, False), + ["Watch2,6"], 1.5, (4,5), "Apple Watch Series 1 38mm", 290, False, False, False, False, False, False, False, False), Device( "appleWatchSeries1_42mm", "Device is an [Apple Watch Series 1](https://support.apple.com/kb/SP745)", "https://km.support.apple.com/resources/sites/APPLE/content/live/IMAGES/0/IM848/en_US/applewatch-series2-aluminum-temp-240.png", - ["Watch2,7"], 1.6, (4,5), "Apple Watch Series 1 42mm", 303, False, False, False, False, False, False, False), + ["Watch2,7"], 1.6, (4,5), "Apple Watch Series 1 42mm", 303, False, False, False, False, False, False, False, False), Device( "appleWatchSeries2_38mm", "Device is an [Apple Watch Series 2](https://support.apple.com/kb/SP746)", "https://km.support.apple.com/resources/sites/APPLE/content/live/IMAGES/0/IM852/en_US/applewatch-series2-hermes-240.png", - ["Watch2,3"], 1.5, (4,5), "Apple Watch Series 2 38mm", 290, False, False, False, False, False, False, False), + ["Watch2,3"], 1.5, (4,5), "Apple Watch Series 2 38mm", 290, False, False, False, False, False, False, False, False), Device( "appleWatchSeries2_42mm", "Device is an [Apple Watch Series 2](https://support.apple.com/kb/SP746)", "https://km.support.apple.com/resources/sites/APPLE/content/live/IMAGES/0/IM852/en_US/applewatch-series2-hermes-240.png", - ["Watch2,4"], 1.6, (4,5), "Apple Watch Series 2 42mm", 303, False, False, False, False, False, False, False), + ["Watch2,4"], 1.6, (4,5), "Apple Watch Series 2 42mm", 303, False, False, False, False, False, False, False, False), Device( "appleWatchSeries3_38mm", "Device is an [Apple Watch Series 3](https://support.apple.com/kb/SP766)", "https://km.support.apple.com/resources/sites/APPLE/content/live/IMAGES/0/IM893/en_US/apple-watch-s3-nikeplus-240.png", - ["Watch3,1", "Watch3,3"], 1.5, (4,5), "Apple Watch Series 3 38mm", 290, False, False, False, False, False, False, False), + ["Watch3,1", "Watch3,3"], 1.5, (4,5), "Apple Watch Series 3 38mm", 290, False, False, False, False, False, False, False, False), Device( "appleWatchSeries3_42mm", "Device is an [Apple Watch Series 3](https://support.apple.com/kb/SP766)", "https://km.support.apple.com/resources/sites/APPLE/content/live/IMAGES/0/IM893/en_US/apple-watch-s3-nikeplus-240.png", - ["Watch3,2", "Watch3,4"], 1.6, (4,5), "Apple Watch Series 3 42mm", 303, False, False, False, False, False, False, False), + ["Watch3,2", "Watch3,4"], 1.6, (4,5), "Apple Watch Series 3 42mm", 303, False, False, False, False, False, False, False, False), Device( "appleWatchSeries4_40mm", "Device is an [Apple Watch Series 4](https://support.apple.com/kb/SP778)", "https://km.support.apple.com/resources/sites/APPLE/content/live/IMAGES/0/IM911/en_US/aw-series4-nike-240.png", - ["Watch4,1", "Watch4,3"], 1.8, (4,5), "Apple Watch Series 4 40mm", 326, False, False, False, False, False, False, False), + ["Watch4,1", "Watch4,3"], 1.8, (4,5), "Apple Watch Series 4 40mm", 326, False, False, False, False, False, False, False, False), Device( "appleWatchSeries4_44mm", "Device is an [Apple Watch Series 4](https://support.apple.com/kb/SP778)", "https://km.support.apple.com/resources/sites/APPLE/content/live/IMAGES/0/IM911/en_US/aw-series4-nike-240.png", - ["Watch4,2", "Watch4,4"], 2.0, (4,5), "Apple Watch Series 4 44mm", 326, False, False, False, False, False, False, False), + ["Watch4,2", "Watch4,4"], 2.0, (4,5), "Apple Watch Series 4 44mm", 326, False, False, False, False, False, False, False, False), ] iOSDevices = iPods + iPhones + iPads + homePods @@ -483,7 +484,7 @@ public enum Device { public var hasBiometricSensor: Bool { return isTouchIDCapable || isFaceIDCapable } - + /// All devices that feature a sensor housing in the screen public static var allDevicesWithSensorHousing: [Device] { return [${', '.join(list(map(lambda device: "." + device.caseName, list(filter(lambda device: device.hasSensorHousing == True, iOSDevices)))))}] @@ -494,6 +495,16 @@ public enum Device { return isOneOf(Device.allDevicesWithSensorHousing) } + /// All devices that feature a screen with rounded corners. + public static var allDevicesWithRoundedDisplayCorners: [Device] { + return [${', '.join(list(map(lambda device: "." + device.caseName, list(filter(lambda device: device.hasRoundedDisplayCorners == True, iOSDevices)))))}] + } + + /// Returns whether or not the device has a screen with rounded corners. + public var hasRoundedDisplayCorners: Bool { + return isOneOf(Device.allDevicesWithRoundedDisplayCorners) + } + #elseif os(tvOS) /// All TVs public static var allTVs: [Device] { From 5458bb7ff83eb23b441177d7cbaee070581bdc83 Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Mon, 18 Mar 2019 09:31:11 +0100 Subject: [PATCH 21/41] Fix documentation inside code to use Device.current instead of the constructor. --- Source/Device.generated.swift | 6 +++--- Source/Device.swift.gyb | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/Device.generated.swift b/Source/Device.generated.swift index 1fae2df0..9aac78e4 100644 --- a/Source/Device.generated.swift +++ b/Source/Device.generated.swift @@ -22,7 +22,7 @@ import UIKit /// /// Usage: /// -/// let device = Device() +/// let device = Device.current /// /// print(device) // prints, for example, "iPhone 6 Plus" /// @@ -701,7 +701,7 @@ public enum Device { Most uses for an enum like this are the following: ``` - switch Device() { + switch Device.current { case .iPodTouch5, .iPodTouch6: callMethodOnIPods() case .iPhone4, iPhone4s, .iPhone5, .iPhone5s, .iPhone6, .iPhone6Plus, .iPhone6s, .iPhone6sPlus, .iPhone7, .iPhone7Plus, .iPhoneSE, .iPhone8, .iPhone8Plus, .iPhoneX: callMethodOnIPhones() case .iPad2, .iPad3, .iPad4, .iPadAir, .iPadAir2, .iPadMini, .iPadMini2, .iPadMini3, .iPadMini4, .iPadPro: callMethodOnIPads() @@ -711,7 +711,7 @@ public enum Device { This code can now be replaced with ``` - let device = Device() + let device = Device.current if device.isOneOf(Device.allPods) { callMethodOnIPods() } else if device.isOneOf(Device.allPhones) { diff --git a/Source/Device.swift.gyb b/Source/Device.swift.gyb index 967497e9..c85e0376 100644 --- a/Source/Device.swift.gyb +++ b/Source/Device.swift.gyb @@ -176,7 +176,7 @@ import UIKit /// /// Usage: /// -/// let device = Device() +/// let device = Device.current /// /// print(device) // prints, for example, "iPhone 6 Plus" /// @@ -548,7 +548,7 @@ public enum Device { Most uses for an enum like this are the following: ``` - switch Device() { + switch Device.current { case .iPodTouch5, .iPodTouch6: callMethodOnIPods() case .iPhone4, iPhone4s, .iPhone5, .iPhone5s, .iPhone6, .iPhone6Plus, .iPhone6s, .iPhone6sPlus, .iPhone7, .iPhone7Plus, .iPhoneSE, .iPhone8, .iPhone8Plus, .iPhoneX: callMethodOnIPhones() case .iPad2, .iPad3, .iPad4, .iPadAir, .iPadAir2, .iPadMini, .iPadMini2, .iPadMini3, .iPadMini4, .iPadPro: callMethodOnIPads() @@ -558,7 +558,7 @@ public enum Device { This code can now be replaced with ``` - let device = Device() + let device = Device.current if device.isOneOf(Device.allPods) { callMethodOnIPods() } else if device.isOneOf(Device.allPhones) { From e43df4fb8054e3e0dcf1a398ccb24fd67ec09b18 Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Mon, 18 Mar 2019 09:32:40 +0100 Subject: [PATCH 22/41] Fixed readme to use Device.current instead of the constructor. --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index fef57d1b..e74f93eb 100644 --- a/README.md +++ b/README.md @@ -101,7 +101,7 @@ You can try these examples in Playground. ### Get the Device You're Running On ```swift -let device = Device() +let device = Device.current print(device) // prints, for example, "iPhone 6 Plus" @@ -114,7 +114,7 @@ if device == .iPhone6Plus { ### Get the Device Family ```swift -let device = Device() +let device = Device.current if device.isPod { // iPods (real or simulator) } else if device.isPhone { @@ -126,7 +126,7 @@ if device.isPod { ### Check If Running on Simulator ```swift -let device = Device() +let device = Device.current if device.isSimulator { // Running on one of the simulators(iPod/iPhone/iPad) // Skip doing something irrelevant for Simulator @@ -135,7 +135,7 @@ if device.isSimulator { ### Get the Simulator Device ```swift -let device = Device() +let device = Device.current switch device { case .simulator(.iPhone6s): break // You're running on the iPhone 6s simulator case .simulator(.iPadAir2): break // You're running on the iPad Air 2 simulator @@ -147,7 +147,7 @@ default: break ```swift let groupOfAllowedDevices: [Device] = [.iPhone6, .iPhone6Plus, .iPhone6s, .iPhone6sPlus, .simulator(.iPhone6), .simulator(.iPhone6Plus),.simulator(.iPhone6s),.simulator(.iPhone6sPlus).simulator(.iPhone8),.simulator(.iPhone8Plus),.simulator(.iPhoneX),.simulator(.iPhoneXS),.simulator(.iPhoneXSMax),.simulator(.iPhoneXR)] -let device = Device() +let device = Device.current if device.isOneOf(groupOfAllowedDevices) { // Do your action From 3eec7cde1dc54da1a7bb91eea32c75749fe6d0bb Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Mon, 18 Mar 2019 19:25:56 +0100 Subject: [PATCH 23/41] Add new iPad Air (3th generation) and iPad Mini (5th generation). --- Source/Device.generated.swift | 26 ++++++++++++++++++++++---- Source/Device.swift.gyb | 2 ++ 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/Source/Device.generated.swift b/Source/Device.generated.swift index 9aac78e4..1b525d6e 100644 --- a/Source/Device.generated.swift +++ b/Source/Device.generated.swift @@ -148,6 +148,10 @@ public enum Device { /// /// ![Image](https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP708/SP708-space_gray.jpeg) case iPadAir2 + /// Device is an [iPad Air (3th generation)](INSERT LINK) + /// + /// ![Image](https://store.storeimages.cdn-apple.com/4982/as-images.apple.com/is/image/AppleInc/aos/published/images/i/pa/ipad/mini/ipad-mini-compare-201903) + case iPadAir3 /// Device is an [iPad (5th generation)](https://support.apple.com/kb/SP751) /// /// ![Image](https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP751/ipad_5th_generation.png) @@ -172,6 +176,10 @@ public enum Device { /// /// ![Image](https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP725/SP725ipad-mini-4.png) case iPadMini4 + /// Device is an [iPad Mini (5th generation)](INSERT LINK) + /// + /// ![Image](https://store.storeimages.cdn-apple.com/4982/as-images.apple.com/is/image/AppleInc/aos/published/images/i/pa/ipad/air/ipad-air-compare-201903) + case iPadMini5 /// Device is an [iPad Pro 9.7-inch](https://support.apple.com/kb/SP739) /// /// ![Image](https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP739/SP739.png) @@ -313,12 +321,14 @@ public enum Device { case "iPad3,4", "iPad3,5", "iPad3,6": return iPad4 case "iPad4,1", "iPad4,2", "iPad4,3": return iPadAir case "iPad5,3", "iPad5,4": return iPadAir2 + case "": return iPadAir3 case "iPad6,11", "iPad6,12": return iPad5 case "iPad7,5", "iPad7,6": return iPad6 case "iPad2,5", "iPad2,6", "iPad2,7": return iPadMini case "iPad4,4", "iPad4,5", "iPad4,6": return iPadMini2 case "iPad4,7", "iPad4,8", "iPad4,9": return iPadMini3 case "iPad5,1", "iPad5,2": return iPadMini4 + case "": return iPadMini5 case "iPad6,3", "iPad6,4": return iPadPro9Inch case "iPad6,7", "iPad6,8": return iPadPro12Inch case "iPad7,1", "iPad7,2": return iPadPro12Inch2 @@ -399,12 +409,14 @@ public enum Device { case .iPad4: return 9.7 case .iPadAir: return 9.7 case .iPadAir2: return 9.7 + case .iPadAir3: return 10.5 case .iPad5: return 9.7 case .iPad6: return 9.7 case .iPadMini: return 7.9 case .iPadMini2: return 7.9 case .iPadMini3: return 7.9 case .iPadMini4: return 7.9 + case .iPadMini5: return 7.9 case .iPadPro9Inch: return 9.7 case .iPadPro12Inch: return 12.9 case .iPadPro12Inch2: return 12.9 @@ -463,12 +475,14 @@ public enum Device { case .iPad4: return (width: 3, height: 4) case .iPadAir: return (width: 3, height: 4) case .iPadAir2: return (width: 3, height: 4) + case .iPadAir3: return (width: 3, height: 4) case .iPad5: return (width: 3, height: 4) case .iPad6: return (width: 3, height: 4) case .iPadMini: return (width: 3, height: 4) case .iPadMini2: return (width: 3, height: 4) case .iPadMini3: return (width: 3, height: 4) case .iPadMini4: return (width: 3, height: 4) + case .iPadMini5: return (width: 3, height: 4) case .iPadPro9Inch: return (width: 3, height: 4) case .iPadPro12Inch: return (width: 3, height: 4) case .iPadPro12Inch2: return (width: 3, height: 4) @@ -512,7 +526,7 @@ public enum Device { /// All iPads public static var allPads: [Device] { - return [.iPad2, .iPad3, .iPad4, .iPadAir, .iPadAir2, .iPad5, .iPad6, .iPadMini, .iPadMini2, .iPadMini3, .iPadMini4, .iPadPro9Inch, .iPadPro12Inch, .iPadPro12Inch2, .iPadPro10Inch, .iPadPro11Inch, .iPadPro12Inch3] + return [.iPad2, .iPad3, .iPad4, .iPadAir, .iPadAir2, .iPadAir3, .iPad5, .iPad6, .iPadMini, .iPadMini2, .iPadMini3, .iPadMini4, .iPadMini5, .iPadPro9Inch, .iPadPro12Inch, .iPadPro12Inch2, .iPadPro10Inch, .iPadPro11Inch, .iPadPro12Inch3] } /// All X-Series Devices @@ -527,12 +541,12 @@ public enum Device { /// All Pro Devices public static var allProDevices: [Device] { - return [.iPadPro9Inch, .iPadPro12Inch, .iPadPro12Inch2, .iPadPro10Inch, .iPadPro11Inch, .iPadPro12Inch3] + return [.iPadAir3, .iPadPro9Inch, .iPadPro12Inch, .iPadPro12Inch2, .iPadPro10Inch, .iPadPro11Inch, .iPadPro12Inch3] } /// All mini Devices public static var allMiniDevices: [Device] { - return [.iPadMini, .iPadMini2, .iPadMini3, .iPadMini4] + return [.iPadMini, .iPadMini2, .iPadMini3, .iPadMini4, .iPadMini5] } /// All simulator iPods @@ -615,7 +629,7 @@ public enum Device { /// All Touch ID Capable Devices public static var allTouchIDCapableDevices: [Device] { - return [.iPhone5s, .iPhone6, .iPhone6Plus, .iPhone6s, .iPhone6sPlus, .iPhone7, .iPhone7Plus, .iPhoneSE, .iPhone8, .iPhone8Plus, .iPadAir2, .iPad5, .iPad6, .iPadMini3, .iPadMini4, .iPadPro9Inch, .iPadPro12Inch, .iPadPro12Inch2, .iPadPro10Inch] + return [.iPhone5s, .iPhone6, .iPhone6Plus, .iPhone6s, .iPhone6sPlus, .iPhone7, .iPhone7Plus, .iPhoneSE, .iPhone8, .iPhone8Plus, .iPadAir2, .iPadAir3, .iPad5, .iPad6, .iPadMini3, .iPadMini4, .iPadMini5, .iPadPro9Inch, .iPadPro12Inch, .iPadPro12Inch2, .iPadPro10Inch] } /// All Face ID Capable Devices @@ -813,12 +827,14 @@ public enum Device { case .iPad4: return 264 case .iPadAir: return 264 case .iPadAir2: return 264 + case .iPadAir3: return 264 case .iPad5: return 264 case .iPad6: return 264 case .iPadMini: return 163 case .iPadMini2: return 326 case .iPadMini3: return 326 case .iPadMini4: return 326 + case .iPadMini5: return 326 case .iPadPro9Inch: return 264 case .iPadPro12Inch: return 264 case .iPadPro12Inch2: return 264 @@ -904,12 +920,14 @@ extension Device: CustomStringConvertible { case .iPad4: return "iPad (4th generation)" case .iPadAir: return "iPad Air" case .iPadAir2: return "iPad Air 2" + case .iPadAir3: return "iPad Air (3th generation)" case .iPad5: return "iPad (5th generation)" case .iPad6: return "iPad (6th generation)" case .iPadMini: return "iPad Mini" case .iPadMini2: return "iPad Mini 2" case .iPadMini3: return "iPad Mini 3" case .iPadMini4: return "iPad Mini 4" + case .iPadMini5: return "iPad Mini (5th generation)" case .iPadPro9Inch: return "iPad Pro (9.7-inch)" case .iPadPro12Inch: return "iPad Pro (12.9-inch)" case .iPadPro12Inch2: return "iPad Pro (12.9-inch) (2nd generation)" diff --git a/Source/Device.swift.gyb b/Source/Device.swift.gyb index c85e0376..7b22f9f2 100644 --- a/Source/Device.swift.gyb +++ b/Source/Device.swift.gyb @@ -63,12 +63,14 @@ iPads = [ Device("iPad4", "Device is an [iPad (4th generation)](https://support.apple.com/kb/SP662)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP662/sp662_ipad-4th-gen_color.jpg", ["iPad3,4", "iPad3,5", "iPad3,6"], 9.7, (3, 4), "iPad (4th generation)", 264, False, False, False, False, False, False, False, False), Device("iPadAir", "Device is an [iPad Air](https://support.apple.com/kb/SP692)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP692/SP692-specs_color-mul.png", ["iPad4,1", "iPad4,2", "iPad4,3"], 9.7, (3, 4), "iPad Air", 264, False, False, False, False, False, False, False, False), Device("iPadAir2", "Device is an [iPad Air 2](https://support.apple.com/kb/SP708)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP708/SP708-space_gray.jpeg", ["iPad5,3", "iPad5,4"], 9.7, (3, 4), "iPad Air 2", 264, False, False, False, False, True, False, False, False), + Device("iPadAir3", "Device is an [iPad Air (3th generation)](INSERT LINK)", "https://store.storeimages.cdn-apple.com/4982/as-images.apple.com/is/image/AppleInc/aos/published/images/i/pa/ipad/mini/ipad-mini-compare-201903", [""], 10.5, (3, 4), "iPad Air (3th generation)", 264, False, False, True, False, True, False, False, False), Device("iPad5", "Device is an [iPad (5th generation)](https://support.apple.com/kb/SP751)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP751/ipad_5th_generation.png", ["iPad6,11", "iPad6,12"], 9.7, (3, 4), "iPad (5th generation)", 264, False, False, False, False, True, False, False, False), Device("iPad6", "Device is an [iPad (6th generation)](https://support.apple.com/kb/NotYetAvailable)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP751/ipad_5th_generation.png", ["iPad7,5", "iPad7,6"], 9.7, (3, 4), "iPad (6th generation)", 264, False, False, False, False, True, False, False, False), Device("iPadMini", "Device is an [iPad Mini](https://support.apple.com/kb/SP661)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP661/sp661_ipad_mini_color.jpg", ["iPad2,5", "iPad2,6", "iPad2,7"], 7.9, (3, 4), "iPad Mini", 163, False, True, False, False, False, False, False, False), Device("iPadMini2", "Device is an [iPad Mini 2](https://support.apple.com/kb/SP693)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP693/SP693-specs_color-mul.png", ["iPad4,4", "iPad4,5", "iPad4,6"], 7.9, (3, 4), "iPad Mini 2", 326, False, True, False, False, False, False, False, False), Device("iPadMini3", "Device is an [iPad Mini 3](https://support.apple.com/kb/SP709)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP709/SP709-space_gray.jpeg", ["iPad4,7", "iPad4,8", "iPad4,9"], 7.9, (3, 4), "iPad Mini 3", 326, False, True, False, False, True, False, False, False), Device("iPadMini4", "Device is an [iPad Mini 4](https://support.apple.com/kb/SP725)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP725/SP725ipad-mini-4.png", ["iPad5,1", "iPad5,2"], 7.9, (3, 4), "iPad Mini 4", 326, False, True, False, False, True, False, False, False), + Device("iPadMini5", "Device is an [iPad Mini (5th generation)](INSERT LINK)", "https://store.storeimages.cdn-apple.com/4982/as-images.apple.com/is/image/AppleInc/aos/published/images/i/pa/ipad/air/ipad-air-compare-201903", [""], 7.9, (3, 4), "iPad Mini (5th generation)", 326, False, True, False, False, True, False, False, False), Device("iPadPro9Inch", "Device is an [iPad Pro 9.7-inch](https://support.apple.com/kb/SP739)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP739/SP739.png", ["iPad6,3", "iPad6,4"], 9.7, (3, 4), "iPad Pro (9.7-inch)", 264, False, False, True, False, True, False, False, False), Device("iPadPro12Inch", "Device is an [iPad Pro 12-inch](https://support.apple.com/kb/sp723)", "http://images.apple.com/v/ipad-pro/c/images/shared/buystrip/ipad_pro_large_2x.png", ["iPad6,7", "iPad6,8"], 12.9, (3, 4), "iPad Pro (12.9-inch)", 264, False, False, True, False, True, False, False, False), Device("iPadPro12Inch2", "Device is an [iPad Pro 12-inch (2nd generation)](https://support.apple.com/kb/SP761)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP761/ipad-pro-12in-hero-201706.png", ["iPad7,1", "iPad7,2"], 12.9, (3, 4), "iPad Pro (12.9-inch) (2nd generation)", 264, False, False, True, False, True, False, False, False), From 2a9728bedad3c5cc9758460a3d08299e419306bb Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Mon, 18 Mar 2019 19:28:38 +0100 Subject: [PATCH 24/41] Revert https://github.com/Zandor300/DeviceKit/commit/3eec7cde1dc54da1a7bb91eea32c75749fe6d0bb --- Source/Device.generated.swift | 26 ++++---------------------- Source/Device.swift.gyb | 2 -- 2 files changed, 4 insertions(+), 24 deletions(-) diff --git a/Source/Device.generated.swift b/Source/Device.generated.swift index 1b525d6e..9aac78e4 100644 --- a/Source/Device.generated.swift +++ b/Source/Device.generated.swift @@ -148,10 +148,6 @@ public enum Device { /// /// ![Image](https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP708/SP708-space_gray.jpeg) case iPadAir2 - /// Device is an [iPad Air (3th generation)](INSERT LINK) - /// - /// ![Image](https://store.storeimages.cdn-apple.com/4982/as-images.apple.com/is/image/AppleInc/aos/published/images/i/pa/ipad/mini/ipad-mini-compare-201903) - case iPadAir3 /// Device is an [iPad (5th generation)](https://support.apple.com/kb/SP751) /// /// ![Image](https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP751/ipad_5th_generation.png) @@ -176,10 +172,6 @@ public enum Device { /// /// ![Image](https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP725/SP725ipad-mini-4.png) case iPadMini4 - /// Device is an [iPad Mini (5th generation)](INSERT LINK) - /// - /// ![Image](https://store.storeimages.cdn-apple.com/4982/as-images.apple.com/is/image/AppleInc/aos/published/images/i/pa/ipad/air/ipad-air-compare-201903) - case iPadMini5 /// Device is an [iPad Pro 9.7-inch](https://support.apple.com/kb/SP739) /// /// ![Image](https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP739/SP739.png) @@ -321,14 +313,12 @@ public enum Device { case "iPad3,4", "iPad3,5", "iPad3,6": return iPad4 case "iPad4,1", "iPad4,2", "iPad4,3": return iPadAir case "iPad5,3", "iPad5,4": return iPadAir2 - case "": return iPadAir3 case "iPad6,11", "iPad6,12": return iPad5 case "iPad7,5", "iPad7,6": return iPad6 case "iPad2,5", "iPad2,6", "iPad2,7": return iPadMini case "iPad4,4", "iPad4,5", "iPad4,6": return iPadMini2 case "iPad4,7", "iPad4,8", "iPad4,9": return iPadMini3 case "iPad5,1", "iPad5,2": return iPadMini4 - case "": return iPadMini5 case "iPad6,3", "iPad6,4": return iPadPro9Inch case "iPad6,7", "iPad6,8": return iPadPro12Inch case "iPad7,1", "iPad7,2": return iPadPro12Inch2 @@ -409,14 +399,12 @@ public enum Device { case .iPad4: return 9.7 case .iPadAir: return 9.7 case .iPadAir2: return 9.7 - case .iPadAir3: return 10.5 case .iPad5: return 9.7 case .iPad6: return 9.7 case .iPadMini: return 7.9 case .iPadMini2: return 7.9 case .iPadMini3: return 7.9 case .iPadMini4: return 7.9 - case .iPadMini5: return 7.9 case .iPadPro9Inch: return 9.7 case .iPadPro12Inch: return 12.9 case .iPadPro12Inch2: return 12.9 @@ -475,14 +463,12 @@ public enum Device { case .iPad4: return (width: 3, height: 4) case .iPadAir: return (width: 3, height: 4) case .iPadAir2: return (width: 3, height: 4) - case .iPadAir3: return (width: 3, height: 4) case .iPad5: return (width: 3, height: 4) case .iPad6: return (width: 3, height: 4) case .iPadMini: return (width: 3, height: 4) case .iPadMini2: return (width: 3, height: 4) case .iPadMini3: return (width: 3, height: 4) case .iPadMini4: return (width: 3, height: 4) - case .iPadMini5: return (width: 3, height: 4) case .iPadPro9Inch: return (width: 3, height: 4) case .iPadPro12Inch: return (width: 3, height: 4) case .iPadPro12Inch2: return (width: 3, height: 4) @@ -526,7 +512,7 @@ public enum Device { /// All iPads public static var allPads: [Device] { - return [.iPad2, .iPad3, .iPad4, .iPadAir, .iPadAir2, .iPadAir3, .iPad5, .iPad6, .iPadMini, .iPadMini2, .iPadMini3, .iPadMini4, .iPadMini5, .iPadPro9Inch, .iPadPro12Inch, .iPadPro12Inch2, .iPadPro10Inch, .iPadPro11Inch, .iPadPro12Inch3] + return [.iPad2, .iPad3, .iPad4, .iPadAir, .iPadAir2, .iPad5, .iPad6, .iPadMini, .iPadMini2, .iPadMini3, .iPadMini4, .iPadPro9Inch, .iPadPro12Inch, .iPadPro12Inch2, .iPadPro10Inch, .iPadPro11Inch, .iPadPro12Inch3] } /// All X-Series Devices @@ -541,12 +527,12 @@ public enum Device { /// All Pro Devices public static var allProDevices: [Device] { - return [.iPadAir3, .iPadPro9Inch, .iPadPro12Inch, .iPadPro12Inch2, .iPadPro10Inch, .iPadPro11Inch, .iPadPro12Inch3] + return [.iPadPro9Inch, .iPadPro12Inch, .iPadPro12Inch2, .iPadPro10Inch, .iPadPro11Inch, .iPadPro12Inch3] } /// All mini Devices public static var allMiniDevices: [Device] { - return [.iPadMini, .iPadMini2, .iPadMini3, .iPadMini4, .iPadMini5] + return [.iPadMini, .iPadMini2, .iPadMini3, .iPadMini4] } /// All simulator iPods @@ -629,7 +615,7 @@ public enum Device { /// All Touch ID Capable Devices public static var allTouchIDCapableDevices: [Device] { - return [.iPhone5s, .iPhone6, .iPhone6Plus, .iPhone6s, .iPhone6sPlus, .iPhone7, .iPhone7Plus, .iPhoneSE, .iPhone8, .iPhone8Plus, .iPadAir2, .iPadAir3, .iPad5, .iPad6, .iPadMini3, .iPadMini4, .iPadMini5, .iPadPro9Inch, .iPadPro12Inch, .iPadPro12Inch2, .iPadPro10Inch] + return [.iPhone5s, .iPhone6, .iPhone6Plus, .iPhone6s, .iPhone6sPlus, .iPhone7, .iPhone7Plus, .iPhoneSE, .iPhone8, .iPhone8Plus, .iPadAir2, .iPad5, .iPad6, .iPadMini3, .iPadMini4, .iPadPro9Inch, .iPadPro12Inch, .iPadPro12Inch2, .iPadPro10Inch] } /// All Face ID Capable Devices @@ -827,14 +813,12 @@ public enum Device { case .iPad4: return 264 case .iPadAir: return 264 case .iPadAir2: return 264 - case .iPadAir3: return 264 case .iPad5: return 264 case .iPad6: return 264 case .iPadMini: return 163 case .iPadMini2: return 326 case .iPadMini3: return 326 case .iPadMini4: return 326 - case .iPadMini5: return 326 case .iPadPro9Inch: return 264 case .iPadPro12Inch: return 264 case .iPadPro12Inch2: return 264 @@ -920,14 +904,12 @@ extension Device: CustomStringConvertible { case .iPad4: return "iPad (4th generation)" case .iPadAir: return "iPad Air" case .iPadAir2: return "iPad Air 2" - case .iPadAir3: return "iPad Air (3th generation)" case .iPad5: return "iPad (5th generation)" case .iPad6: return "iPad (6th generation)" case .iPadMini: return "iPad Mini" case .iPadMini2: return "iPad Mini 2" case .iPadMini3: return "iPad Mini 3" case .iPadMini4: return "iPad Mini 4" - case .iPadMini5: return "iPad Mini (5th generation)" case .iPadPro9Inch: return "iPad Pro (9.7-inch)" case .iPadPro12Inch: return "iPad Pro (12.9-inch)" case .iPadPro12Inch2: return "iPad Pro (12.9-inch) (2nd generation)" diff --git a/Source/Device.swift.gyb b/Source/Device.swift.gyb index 7b22f9f2..c85e0376 100644 --- a/Source/Device.swift.gyb +++ b/Source/Device.swift.gyb @@ -63,14 +63,12 @@ iPads = [ Device("iPad4", "Device is an [iPad (4th generation)](https://support.apple.com/kb/SP662)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP662/sp662_ipad-4th-gen_color.jpg", ["iPad3,4", "iPad3,5", "iPad3,6"], 9.7, (3, 4), "iPad (4th generation)", 264, False, False, False, False, False, False, False, False), Device("iPadAir", "Device is an [iPad Air](https://support.apple.com/kb/SP692)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP692/SP692-specs_color-mul.png", ["iPad4,1", "iPad4,2", "iPad4,3"], 9.7, (3, 4), "iPad Air", 264, False, False, False, False, False, False, False, False), Device("iPadAir2", "Device is an [iPad Air 2](https://support.apple.com/kb/SP708)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP708/SP708-space_gray.jpeg", ["iPad5,3", "iPad5,4"], 9.7, (3, 4), "iPad Air 2", 264, False, False, False, False, True, False, False, False), - Device("iPadAir3", "Device is an [iPad Air (3th generation)](INSERT LINK)", "https://store.storeimages.cdn-apple.com/4982/as-images.apple.com/is/image/AppleInc/aos/published/images/i/pa/ipad/mini/ipad-mini-compare-201903", [""], 10.5, (3, 4), "iPad Air (3th generation)", 264, False, False, True, False, True, False, False, False), Device("iPad5", "Device is an [iPad (5th generation)](https://support.apple.com/kb/SP751)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP751/ipad_5th_generation.png", ["iPad6,11", "iPad6,12"], 9.7, (3, 4), "iPad (5th generation)", 264, False, False, False, False, True, False, False, False), Device("iPad6", "Device is an [iPad (6th generation)](https://support.apple.com/kb/NotYetAvailable)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP751/ipad_5th_generation.png", ["iPad7,5", "iPad7,6"], 9.7, (3, 4), "iPad (6th generation)", 264, False, False, False, False, True, False, False, False), Device("iPadMini", "Device is an [iPad Mini](https://support.apple.com/kb/SP661)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP661/sp661_ipad_mini_color.jpg", ["iPad2,5", "iPad2,6", "iPad2,7"], 7.9, (3, 4), "iPad Mini", 163, False, True, False, False, False, False, False, False), Device("iPadMini2", "Device is an [iPad Mini 2](https://support.apple.com/kb/SP693)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP693/SP693-specs_color-mul.png", ["iPad4,4", "iPad4,5", "iPad4,6"], 7.9, (3, 4), "iPad Mini 2", 326, False, True, False, False, False, False, False, False), Device("iPadMini3", "Device is an [iPad Mini 3](https://support.apple.com/kb/SP709)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP709/SP709-space_gray.jpeg", ["iPad4,7", "iPad4,8", "iPad4,9"], 7.9, (3, 4), "iPad Mini 3", 326, False, True, False, False, True, False, False, False), Device("iPadMini4", "Device is an [iPad Mini 4](https://support.apple.com/kb/SP725)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP725/SP725ipad-mini-4.png", ["iPad5,1", "iPad5,2"], 7.9, (3, 4), "iPad Mini 4", 326, False, True, False, False, True, False, False, False), - Device("iPadMini5", "Device is an [iPad Mini (5th generation)](INSERT LINK)", "https://store.storeimages.cdn-apple.com/4982/as-images.apple.com/is/image/AppleInc/aos/published/images/i/pa/ipad/air/ipad-air-compare-201903", [""], 7.9, (3, 4), "iPad Mini (5th generation)", 326, False, True, False, False, True, False, False, False), Device("iPadPro9Inch", "Device is an [iPad Pro 9.7-inch](https://support.apple.com/kb/SP739)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP739/SP739.png", ["iPad6,3", "iPad6,4"], 9.7, (3, 4), "iPad Pro (9.7-inch)", 264, False, False, True, False, True, False, False, False), Device("iPadPro12Inch", "Device is an [iPad Pro 12-inch](https://support.apple.com/kb/sp723)", "http://images.apple.com/v/ipad-pro/c/images/shared/buystrip/ipad_pro_large_2x.png", ["iPad6,7", "iPad6,8"], 12.9, (3, 4), "iPad Pro (12.9-inch)", 264, False, False, True, False, True, False, False, False), Device("iPadPro12Inch2", "Device is an [iPad Pro 12-inch (2nd generation)](https://support.apple.com/kb/SP761)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP761/ipad-pro-12in-hero-201706.png", ["iPad7,1", "iPad7,2"], 12.9, (3, 4), "iPad Pro (12.9-inch) (2nd generation)", 264, False, False, True, False, True, False, False, False), From e12017c6be4b5e0673a68e509303551adcfe9b4b Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Fri, 29 Mar 2019 19:03:25 +0100 Subject: [PATCH 25/41] Update to Swift 5. --- DeviceKit.xcodeproj/project.pbxproj | 13 +++++++------ Source/Device.generated.swift | 2 ++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/DeviceKit.xcodeproj/project.pbxproj b/DeviceKit.xcodeproj/project.pbxproj index 354686a3..d5227d79 100644 --- a/DeviceKit.xcodeproj/project.pbxproj +++ b/DeviceKit.xcodeproj/project.pbxproj @@ -210,12 +210,12 @@ }; 955EE5991D5E581B008C3DA8 = { CreatedOnToolsVersion = 8.0; - LastSwiftMigration = 0900; + LastSwiftMigration = 1020; ProvisioningStyle = Automatic; }; 955EE5A11D5E581B008C3DA8 = { CreatedOnToolsVersion = 8.0; - LastSwiftMigration = 0900; + LastSwiftMigration = 1020; ProvisioningStyle = Automatic; }; }; @@ -225,6 +225,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, ); mainGroup = 95CBDB631BFD2B440065FC66; @@ -384,7 +385,7 @@ SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2,3"; TVOS_DEPLOYMENT_TARGET = 9.0; VERSIONING_SYSTEM = "apple-generic"; @@ -437,7 +438,7 @@ RUN_CLANG_STATIC_ANALYZER = YES; SDKROOT = iphoneos; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2,3"; TVOS_DEPLOYMENT_TARGET = 9.0; VALIDATE_PRODUCT = YES; @@ -489,7 +490,7 @@ SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OBJC_INTERFACE_HEADER_NAME = ""; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_SWIFT3_OBJC_INFERENCE = Off; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -530,7 +531,7 @@ SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OBJC_INTERFACE_HEADER_NAME = ""; SWIFT_OPTIMIZATION_LEVEL = "-O"; - SWIFT_SWIFT3_OBJC_INFERENCE = Off; + SWIFT_VERSION = 5.0; VALIDATE_PRODUCT = YES; }; name = Release; diff --git a/Source/Device.generated.swift b/Source/Device.generated.swift index 9aac78e4..ae762b08 100644 --- a/Source/Device.generated.swift +++ b/Source/Device.generated.swift @@ -993,6 +993,8 @@ extension Device { case .full: self = .full case .unplugged: self = .unplugged(batteryLevel) case .unknown: self = .full // Should never happen since `batteryMonitoring` is enabled. + @unknown default: + self = .full // To cover any future additions for which DeviceKit might not have updated yet. } UIDevice.current.isBatteryMonitoringEnabled = wasBatteryMonitoringEnabled } From 8f2c68f4e98dc8f813b184250e4a497a657d0db5 Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Fri, 29 Mar 2019 19:03:47 +0100 Subject: [PATCH 26/41] Update tests for breaking changes. --- Tests/Tests.swift | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/Tests/Tests.swift b/Tests/Tests.swift index 9bcb811e..8035771d 100644 --- a/Tests/Tests.swift +++ b/Tests/Tests.swift @@ -14,7 +14,7 @@ import XCTest class DeviceKitTests: XCTestCase { - let device = Device() + let device = Device.current func testDeviceSimulator() { XCTAssertTrue(device.isOneOf(Device.allSimulators)) @@ -68,10 +68,10 @@ class DeviceKitTests: XCTestCase { XCTAssertEqual(Device.mapToDevice(identifier: "iPhone10,5"), .iPhone8Plus) XCTAssertEqual(Device.mapToDevice(identifier: "iPhone10,3"), .iPhoneX) XCTAssertEqual(Device.mapToDevice(identifier: "iPhone10,6"), .iPhoneX) - XCTAssertEqual(Device.mapToDevice(identifier: "iPhone11,2"), .iPhoneXs) - XCTAssertEqual(Device.mapToDevice(identifier: "iPhone11,4"), .iPhoneXsMax) - XCTAssertEqual(Device.mapToDevice(identifier: "iPhone11,6"), .iPhoneXsMax) - XCTAssertEqual(Device.mapToDevice(identifier: "iPhone11,8"), .iPhoneXr) + XCTAssertEqual(Device.mapToDevice(identifier: "iPhone11,2"), .iPhoneXS) + XCTAssertEqual(Device.mapToDevice(identifier: "iPhone11,4"), .iPhoneXSMax) + XCTAssertEqual(Device.mapToDevice(identifier: "iPhone11,6"), .iPhoneXSMax) + XCTAssertEqual(Device.mapToDevice(identifier: "iPhone11,8"), .iPhoneXR) XCTAssertEqual(Device.mapToDevice(identifier: "iPad2,1"), .iPad2) XCTAssertEqual(Device.mapToDevice(identifier: "iPad2,2"), .iPad2) XCTAssertEqual(Device.mapToDevice(identifier: "iPad2,3"), .iPad2) @@ -136,9 +136,9 @@ class DeviceKitTests: XCTestCase { XCTAssertTrue(Device.iPhone8.screenRatio == (width: 9, height: 16)) XCTAssertTrue(Device.iPhone8Plus.screenRatio == (width: 9, height: 16)) XCTAssertTrue(Device.iPhoneX.screenRatio == (width: 9, height: 19.5)) - XCTAssertTrue(Device.iPhoneXs.screenRatio == (width: 9, height: 19.5)) - XCTAssertTrue(Device.iPhoneXsMax.screenRatio == (width: 9, height: 19.5)) - XCTAssertTrue(Device.iPhoneXr.screenRatio == (width: 9, height: 19.5)) + XCTAssertTrue(Device.iPhoneXS.screenRatio == (width: 9, height: 19.5)) + XCTAssertTrue(Device.iPhoneXSMax.screenRatio == (width: 9, height: 19.5)) + XCTAssertTrue(Device.iPhoneXR.screenRatio == (width: 9, height: 19.5)) XCTAssertTrue(Device.iPad2.screenRatio == (width: 3, height: 4)) XCTAssertTrue(Device.iPad3.screenRatio == (width: 3, height: 4)) XCTAssertTrue(Device.iPad4.screenRatio == (width: 3, height: 4)) @@ -181,9 +181,9 @@ class DeviceKitTests: XCTestCase { XCTAssertEqual(Device.iPhone7Plus.diagonal, 5.5) XCTAssertEqual(Device.iPhone8Plus.diagonal, 5.5) XCTAssertEqual(Device.iPhoneX.diagonal, 5.8) - XCTAssertEqual(Device.iPhoneXs.diagonal, 5.8) - XCTAssertEqual(Device.iPhoneXsMax.diagonal, 6.5) - XCTAssertEqual(Device.iPhoneXr.diagonal, 6.1) + XCTAssertEqual(Device.iPhoneXS.diagonal, 5.8) + XCTAssertEqual(Device.iPhoneXSMax.diagonal, 6.5) + XCTAssertEqual(Device.iPhoneXR.diagonal, 6.1) XCTAssertEqual(Device.iPad2.diagonal, 9.7) XCTAssertEqual(Device.iPad3.diagonal, 9.7) @@ -226,9 +226,9 @@ class DeviceKitTests: XCTestCase { XCTAssertEqual(Device.iPhone8.description, "iPhone 8") XCTAssertEqual(Device.iPhone8Plus.description, "iPhone 8 Plus") XCTAssertEqual(Device.iPhoneX.description, "iPhone X") - XCTAssertEqual(Device.iPhoneXs.description, "iPhone Xs") - XCTAssertEqual(Device.iPhoneXsMax.description, "iPhone Xs Max") - XCTAssertEqual(Device.iPhoneXr.description, "iPhone Xr") + XCTAssertEqual(Device.iPhoneXS.description, "iPhone Xs") + XCTAssertEqual(Device.iPhoneXSMax.description, "iPhone Xs Max") + XCTAssertEqual(Device.iPhoneXR.description, "iPhone Xʀ") XCTAssertEqual(Device.iPad2.description, "iPad 2") XCTAssertEqual(Device.iPad3.description, "iPad 3") XCTAssertEqual(Device.iPad4.description, "iPad 4") @@ -276,9 +276,9 @@ class DeviceKitTests: XCTestCase { assertEqualDeviceAndSimulator(device: Device.iPhone8, property: \Device.ppi, value: 326) assertEqualDeviceAndSimulator(device: Device.iPhone8Plus, property: \Device.ppi, value: 401) assertEqualDeviceAndSimulator(device: Device.iPhoneX, property: \Device.ppi, value: 458) - assertEqualDeviceAndSimulator(device: Device.iPhoneXr, property: \Device.ppi, value: 326) - assertEqualDeviceAndSimulator(device: Device.iPhoneXs, property: \Device.ppi, value: 458) - assertEqualDeviceAndSimulator(device: Device.iPhoneXsMax, property: \Device.ppi, value: 458) + assertEqualDeviceAndSimulator(device: Device.iPhoneXR, property: \Device.ppi, value: 326) + assertEqualDeviceAndSimulator(device: Device.iPhoneXS, property: \Device.ppi, value: 458) + assertEqualDeviceAndSimulator(device: Device.iPhoneXSMax, property: \Device.ppi, value: 458) assertEqualDeviceAndSimulator(device: Device.iPad2, property: \Device.ppi, value: 132) assertEqualDeviceAndSimulator(device: Device.iPad3, property: \Device.ppi, value: 264) @@ -319,18 +319,18 @@ class DeviceKitTests: XCTestCase { } func testGuidedAccessSession() { - XCTAssertFalse(Device().isGuidedAccessSessionActive) + XCTAssertFalse(Device.current.isGuidedAccessSessionActive) } // enable once unit tests can be run on device func testKeepsBatteryMonitoringState() { UIDevice.current.isBatteryMonitoringEnabled = true XCTAssertTrue(UIDevice.current.isBatteryMonitoringEnabled) - _ = Device().batteryState + _ = Device.current.batteryState XCTAssertTrue(UIDevice.current.isBatteryMonitoringEnabled) UIDevice.current.isBatteryMonitoringEnabled = false - _ = Device().batteryState + _ = Device.current.batteryState XCTAssertFalse(UIDevice.current.isBatteryMonitoringEnabled) } From 23267518a9350c8f1d53a396e99912b59a4f7bbe Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Fri, 29 Mar 2019 19:36:02 +0100 Subject: [PATCH 27/41] Fix merge. --- Source/Device.generated.swift | 10 ---------- Source/Device.swift.gyb | 6 ++++-- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/Source/Device.generated.swift b/Source/Device.generated.swift index 1d264dea..5348ebbe 100644 --- a/Source/Device.generated.swift +++ b/Source/Device.generated.swift @@ -661,16 +661,6 @@ public enum Device { public var hasSensorHousing: Bool { return isOneOf(Device.allDevicesWithSensorHousing) } - - /// All devices that feature a screen with rounded corners. - public static var allDevicesWithRoundedDisplayCorners: [Device] { - return [.iPhoneX, .iPhoneXs, .iPhoneXsMax, .iPhoneXr, .iPadPro11Inch, .iPadPro12Inch3] - } - - /// Returns whether or not the device has a screen with rounded corners. - public var hasRoundedDisplayCorners: Bool { - return isOneOf(Device.allDevicesWithRoundedDisplayCorners) - } /// All devices that feature a screen with rounded corners. public static var allDevicesWithRoundedDisplayCorners: [Device] { diff --git a/Source/Device.swift.gyb b/Source/Device.swift.gyb index 773d31c9..612ad1f6 100644 --- a/Source/Device.swift.gyb +++ b/Source/Device.swift.gyb @@ -65,12 +65,12 @@ iPads = [ Device("iPadAir2", "Device is an [iPad Air 2](https://support.apple.com/kb/SP708)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP708/SP708-space_gray.jpeg", ["iPad5,3", "iPad5,4"], 9.7, (3, 4), "iPad Air 2", 264, False, False, False, False, True, False, False, False), Device("iPad5", "Device is an [iPad (5th generation)](https://support.apple.com/kb/SP751)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP751/ipad_5th_generation.png", ["iPad6,11", "iPad6,12"], 9.7, (3, 4), "iPad (5th generation)", 264, False, False, False, False, True, False, False, False), Device("iPad6", "Device is an [iPad (6th generation)](https://support.apple.com/kb/NotYetAvailable)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP751/ipad_5th_generation.png", ["iPad7,5", "iPad7,6"], 9.7, (3, 4), "iPad (6th generation)", 264, False, False, False, False, True, False, False, False), - Device("iPadAir3", "Device is an [iPad Air (3rd generation)](INSERT LINK)", "https://store.storeimages.cdn-apple.com/4982/as-images.apple.com/is/image/AppleInc/aos/published/images/i/pa/ipad/mini/ipad-mini-compare-201903", ["iPad11,3", "iPad11,4"], 10.5, (3, 4), "iPad Air (3rd generation)", 264, False, False, False, False, True, False), + Device("iPadAir3", "Device is an [iPad Air (3rd generation)](INSERT LINK)", "https://store.storeimages.cdn-apple.com/4982/as-images.apple.com/is/image/AppleInc/aos/published/images/i/pa/ipad/mini/ipad-mini-compare-201903", ["iPad11,3", "iPad11,4"], 10.5, (3, 4), "iPad Air (3rd generation)", 264, False, False, False, False, True, False, False, False), Device("iPadMini", "Device is an [iPad Mini](https://support.apple.com/kb/SP661)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP661/sp661_ipad_mini_color.jpg", ["iPad2,5", "iPad2,6", "iPad2,7"], 7.9, (3, 4), "iPad Mini", 163, False, True, False, False, False, False, False, False), Device("iPadMini2", "Device is an [iPad Mini 2](https://support.apple.com/kb/SP693)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP693/SP693-specs_color-mul.png", ["iPad4,4", "iPad4,5", "iPad4,6"], 7.9, (3, 4), "iPad Mini 2", 326, False, True, False, False, False, False, False, False), Device("iPadMini3", "Device is an [iPad Mini 3](https://support.apple.com/kb/SP709)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP709/SP709-space_gray.jpeg", ["iPad4,7", "iPad4,8", "iPad4,9"], 7.9, (3, 4), "iPad Mini 3", 326, False, True, False, False, True, False, False, False), Device("iPadMini4", "Device is an [iPad Mini 4](https://support.apple.com/kb/SP725)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP725/SP725ipad-mini-4.png", ["iPad5,1", "iPad5,2"], 7.9, (3, 4), "iPad Mini 4", 326, False, True, False, False, True, False, False, False), - Device("iPadMini5", "Device is an [iPad Mini (5th generation)](INSERT LINK)", "https://store.storeimages.cdn-apple.com/4982/as-images.apple.com/is/image/AppleInc/aos/published/images/i/pa/ipad/air/ipad-air-compare-201903", ["iPad11,1", "iPad11,2"], 7.9, (3, 4), "iPad Mini (5th generation)", 326, False, True, False, False, True, False), + Device("iPadMini5", "Device is an [iPad Mini (5th generation)](INSERT LINK)", "https://store.storeimages.cdn-apple.com/4982/as-images.apple.com/is/image/AppleInc/aos/published/images/i/pa/ipad/air/ipad-air-compare-201903", ["iPad11,1", "iPad11,2"], 7.9, (3, 4), "iPad Mini (5th generation)", 326, False, True, False, False, True, False, False, False), Device("iPadPro9Inch", "Device is an [iPad Pro 9.7-inch](https://support.apple.com/kb/SP739)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP739/SP739.png", ["iPad6,3", "iPad6,4"], 9.7, (3, 4), "iPad Pro (9.7-inch)", 264, False, False, True, False, True, False, False, False), Device("iPadPro12Inch", "Device is an [iPad Pro 12-inch](https://support.apple.com/kb/sp723)", "http://images.apple.com/v/ipad-pro/c/images/shared/buystrip/ipad_pro_large_2x.png", ["iPad6,7", "iPad6,8"], 12.9, (3, 4), "iPad Pro (12.9-inch)", 264, False, False, True, False, True, False, False, False), Device("iPadPro12Inch2", "Device is an [iPad Pro 12-inch (2nd generation)](https://support.apple.com/kb/SP761)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP761/ipad-pro-12in-hero-201706.png", ["iPad7,1", "iPad7,2"], 12.9, (3, 4), "iPad Pro (12.9-inch) (2nd generation)", 264, False, False, True, False, True, False, False, False), @@ -759,6 +759,8 @@ extension Device { case .full: self = .full case .unplugged: self = .unplugged(batteryLevel) case .unknown: self = .full // Should never happen since `batteryMonitoring` is enabled. + @unknown default: + self = .full // To cover any future additions for which DeviceKit might not have updated yet. } UIDevice.current.isBatteryMonitoringEnabled = wasBatteryMonitoringEnabled } From 9c342f6ec3aee5247c9075b1f55447fab3caac87 Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Fri, 29 Mar 2019 19:46:41 +0100 Subject: [PATCH 28/41] Fixed code alignment. --- Source/Device.swift.gyb | 84 ++++++++++++++++++++--------------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/Source/Device.swift.gyb b/Source/Device.swift.gyb index 612ad1f6..722e6565 100644 --- a/Source/Device.swift.gyb +++ b/Source/Device.swift.gyb @@ -32,61 +32,61 @@ class Device: # iOS iPods = [ - Device("iPodTouch5", "Device is an [iPod Touch (5th generation)](https://support.apple.com/kb/SP657)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP657/sp657_ipod-touch_size.jpg", ["iPod5,1"], 4, (9, 16), "iPod Touch 5", 326, False, False, False, False, False, False, False, False), - Device("iPodTouch6", "Device is an [iPod Touch (6th generation)](https://support.apple.com/kb/SP720)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP720/SP720-ipod-touch-specs-color-sg-2015.jpg", ["iPod7,1"], 4, (9, 16), "iPod Touch 6", 326, False, False, False, False, False, False, False, False) + Device("iPodTouch5", "Device is an [iPod Touch (5th generation)](https://support.apple.com/kb/SP657)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP657/sp657_ipod-touch_size.jpg", ["iPod5,1"], 4, (9, 16), "iPod Touch 5", 326, False, False, False, False, False, False, False, False), + Device("iPodTouch6", "Device is an [iPod Touch (6th generation)](https://support.apple.com/kb/SP720)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP720/SP720-ipod-touch-specs-color-sg-2015.jpg", ["iPod7,1"], 4, (9, 16), "iPod Touch 6", 326, False, False, False, False, False, False, False, False) ] iPhones = [ - Device("iPhone4", "Device is an [iPhone 4](https://support.apple.com/kb/SP587)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP643/sp643_iphone4s_color_black.jpg", ["iPhone3,1", "iPhone3,2", "iPhone3,3"], 3.5, (2, 3), "iPhone 4", 326, False, False, False, False, False, False, False, False), - Device("iPhone4s", "Device is an [iPhone 4s](https://support.apple.com/kb/SP643)", "https://support.apple.com/library/content/dam/edam/applecare/images/en_US/iphone/iphone5s/iphone_4s.png", ["iPhone4,1"], 3.5, (2, 3), "iPhone 4s", 326, False, False, False, False, False, False, False, False), - Device("iPhone5", "Device is an [iPhone 5](https://support.apple.com/kb/SP655)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP655/sp655_iphone5_color.jpg", ["iPhone5,1", "iPhone5,2"], 4, (9, 16), "iPhone 5", 326, False, False, False, False, False, False, False, False), - Device("iPhone5c", "Device is an [iPhone 5c](https://support.apple.com/kb/SP684)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP684/SP684-color_yellow.jpg", ["iPhone5,3", "iPhone5,4"], 4, (9, 16), "iPhone 5c", 326, False, False, False, False, False, False, False, False), - Device("iPhone5s", "Device is an [iPhone 5s](https://support.apple.com/kb/SP685)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP685/SP685-color_black.jpg", ["iPhone6,1", "iPhone6,2"], 4, (9, 16), "iPhone 5s", 326, False, False, False, False, True, False, False, False), - Device("iPhone6", "Device is an [iPhone 6](https://support.apple.com/kb/SP705)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP705/SP705-iphone_6-mul.png", ["iPhone7,2"], 4.7, (9, 16), "iPhone 6", 326, False, False, False, False, True, False, False, False), - Device("iPhone6Plus", "Device is an [iPhone 6 Plus](https://support.apple.com/kb/SP706)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP706/SP706-iphone_6_plus-mul.png", ["iPhone7,1"], 5.5, (9, 16), "iPhone 6 Plus", 401, True, False, False, False, True, False, False, False), - Device("iPhone6s", "Device is an [iPhone 6s](https://support.apple.com/kb/SP726)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP726/SP726-iphone6s-gray-select-2015.png", ["iPhone8,1"], 4.7, (9, 16), "iPhone 6s", 326, False, False, False, False, True, False, False, False), - Device("iPhone6sPlus", "Device is an [iPhone 6s Plus](https://support.apple.com/kb/SP727)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP727/SP727-iphone6s-plus-gray-select-2015.png", ["iPhone8,2"], 5.5, (9, 16), "iPhone 6s Plus", 401, True, False, False, False, True, False, False, False), - Device("iPhone7", "Device is an [iPhone 7](https://support.apple.com/kb/SP743)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP743/iphone7-black.png", ["iPhone9,1", "iPhone9,3"], 4.7, (9, 16), "iPhone 7", 326, False, False, False, False, True, False, False, False), - Device("iPhone7Plus", "Device is an [iPhone 7 Plus](https://support.apple.com/kb/SP744)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP744/iphone7-plus-black.png", ["iPhone9,2", "iPhone9,4"], 5.5, (9, 16), "iPhone 7 Plus", 401, True, False, False, False, True, False, False, False), - Device("iPhoneSE", "Device is an [iPhone SE](https://support.apple.com/kb/SP738)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP738/SP738.png", ["iPhone8,4"], 4, (9, 16), "iPhone SE", 326, False, False, False, False, True, False, False, False), - Device("iPhone8", "Device is an [iPhone 8](https://support.apple.com/kb/SP767)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP767/iphone8.png", ["iPhone10,1", "iPhone10,4"], 4.7, (9, 16), "iPhone 8", 326, False, False, False, False, True, False, False, False), - Device("iPhone8Plus", "Device is an [iPhone 8 Plus](https://support.apple.com/kb/SP768)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP768/iphone8plus.png", ["iPhone10,2", "iPhone10,5"], 5.5, (9, 16), "iPhone 8 Plus", 401, True, False, False, False, True, False, False, False), - Device("iPhoneX", "Device is an [iPhone X](https://support.apple.com/kb/SP770)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP770/iphonex.png", ["iPhone10,3", "iPhone10,6"], 5.8, (9, 19.5), "iPhone X", 458, False, False, False, True, False, True, True, True), - Device("iPhoneXS", "Device is an [iPhone Xs](https://support.apple.com/kb/SP779)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP779/SP779-iphone-xs.jpg", ["iPhone11,2"], 5.8, (9, 19.5), "iPhone Xs", 458, False, False, False, True, False, True, True, True), - Device("iPhoneXSMax", "Device is an [iPhone Xs Max](https://support.apple.com/kb/SP780)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP780/SP780-iPhone-Xs-Max.jpg", ["iPhone11,4", "iPhone11,6"], 6.5, (9, 19.5), "iPhone Xs Max", 458, False, False, False, True, False, True, True, True), - Device("iPhoneXR", "Device is an [iPhone Xʀ](https://support.apple.com/kb/SP781)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP781/SP781-iPhone-xr.jpg", ["iPhone11,8"], 6.1, (9, 19.5), "iPhone Xʀ", 326, False, False, False, True, False, True, True, True) + Device("iPhone4", "Device is an [iPhone 4](https://support.apple.com/kb/SP587)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP643/sp643_iphone4s_color_black.jpg", ["iPhone3,1", "iPhone3,2", "iPhone3,3"], 3.5, (2, 3), "iPhone 4", 326, False, False, False, False, False, False, False, False), + Device("iPhone4s", "Device is an [iPhone 4s](https://support.apple.com/kb/SP643)", "https://support.apple.com/library/content/dam/edam/applecare/images/en_US/iphone/iphone5s/iphone_4s.png", ["iPhone4,1"], 3.5, (2, 3), "iPhone 4s", 326, False, False, False, False, False, False, False, False), + Device("iPhone5", "Device is an [iPhone 5](https://support.apple.com/kb/SP655)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP655/sp655_iphone5_color.jpg", ["iPhone5,1", "iPhone5,2"], 4, (9, 16), "iPhone 5", 326, False, False, False, False, False, False, False, False), + Device("iPhone5c", "Device is an [iPhone 5c](https://support.apple.com/kb/SP684)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP684/SP684-color_yellow.jpg", ["iPhone5,3", "iPhone5,4"], 4, (9, 16), "iPhone 5c", 326, False, False, False, False, False, False, False, False), + Device("iPhone5s", "Device is an [iPhone 5s](https://support.apple.com/kb/SP685)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP685/SP685-color_black.jpg", ["iPhone6,1", "iPhone6,2"], 4, (9, 16), "iPhone 5s", 326, False, False, False, False, True, False, False, False), + Device("iPhone6", "Device is an [iPhone 6](https://support.apple.com/kb/SP705)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP705/SP705-iphone_6-mul.png", ["iPhone7,2"], 4.7, (9, 16), "iPhone 6", 326, False, False, False, False, True, False, False, False), + Device("iPhone6Plus", "Device is an [iPhone 6 Plus](https://support.apple.com/kb/SP706)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP706/SP706-iphone_6_plus-mul.png", ["iPhone7,1"], 5.5, (9, 16), "iPhone 6 Plus", 401, True, False, False, False, True, False, False, False), + Device("iPhone6s", "Device is an [iPhone 6s](https://support.apple.com/kb/SP726)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP726/SP726-iphone6s-gray-select-2015.png", ["iPhone8,1"], 4.7, (9, 16), "iPhone 6s", 326, False, False, False, False, True, False, False, False), + Device("iPhone6sPlus", "Device is an [iPhone 6s Plus](https://support.apple.com/kb/SP727)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP727/SP727-iphone6s-plus-gray-select-2015.png", ["iPhone8,2"], 5.5, (9, 16), "iPhone 6s Plus", 401, True, False, False, False, True, False, False, False), + Device("iPhone7", "Device is an [iPhone 7](https://support.apple.com/kb/SP743)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP743/iphone7-black.png", ["iPhone9,1", "iPhone9,3"], 4.7, (9, 16), "iPhone 7", 326, False, False, False, False, True, False, False, False), + Device("iPhone7Plus", "Device is an [iPhone 7 Plus](https://support.apple.com/kb/SP744)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP744/iphone7-plus-black.png", ["iPhone9,2", "iPhone9,4"], 5.5, (9, 16), "iPhone 7 Plus", 401, True, False, False, False, True, False, False, False), + Device("iPhoneSE", "Device is an [iPhone SE](https://support.apple.com/kb/SP738)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP738/SP738.png", ["iPhone8,4"], 4, (9, 16), "iPhone SE", 326, False, False, False, False, True, False, False, False), + Device("iPhone8", "Device is an [iPhone 8](https://support.apple.com/kb/SP767)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP767/iphone8.png", ["iPhone10,1", "iPhone10,4"], 4.7, (9, 16), "iPhone 8", 326, False, False, False, False, True, False, False, False), + Device("iPhone8Plus", "Device is an [iPhone 8 Plus](https://support.apple.com/kb/SP768)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP768/iphone8plus.png", ["iPhone10,2", "iPhone10,5"], 5.5, (9, 16), "iPhone 8 Plus", 401, True, False, False, False, True, False, False, False), + Device("iPhoneX", "Device is an [iPhone X](https://support.apple.com/kb/SP770)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP770/iphonex.png", ["iPhone10,3", "iPhone10,6"], 5.8, (9, 19.5), "iPhone X", 458, False, False, False, True, False, True, True, True), + Device("iPhoneXS", "Device is an [iPhone Xs](https://support.apple.com/kb/SP779)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP779/SP779-iphone-xs.jpg", ["iPhone11,2"], 5.8, (9, 19.5), "iPhone Xs", 458, False, False, False, True, False, True, True, True), + Device("iPhoneXSMax", "Device is an [iPhone Xs Max](https://support.apple.com/kb/SP780)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP780/SP780-iPhone-Xs-Max.jpg", ["iPhone11,4", "iPhone11,6"], 6.5, (9, 19.5), "iPhone Xs Max", 458, False, False, False, True, False, True, True, True), + Device("iPhoneXR", "Device is an [iPhone Xʀ](https://support.apple.com/kb/SP781)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP781/SP781-iPhone-xr.jpg", ["iPhone11,8"], 6.1, (9, 19.5), "iPhone Xʀ", 326, False, False, False, True, False, True, True, True) ] iPads = [ - Device("iPad2", "Device is an [iPad 2](https://support.apple.com/kb/SP622)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP622/SP622_01-ipad2-mul.png", ["iPad2,1", "iPad2,2", "iPad2,3", "iPad2,4"], 9.7, (3, 4), "iPad 2", 132, False, False, False, False, False, False, False, False), - Device("iPad3", "Device is an [iPad (3rd generation)](https://support.apple.com/kb/SP647)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP662/sp662_ipad-4th-gen_color.jpg", ["iPad3,1", "iPad3,2", "iPad3,3"], 9.7, (3, 4), "iPad (3rd generation)", 264, False, False, False, False, False, False, False, False), - Device("iPad4", "Device is an [iPad (4th generation)](https://support.apple.com/kb/SP662)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP662/sp662_ipad-4th-gen_color.jpg", ["iPad3,4", "iPad3,5", "iPad3,6"], 9.7, (3, 4), "iPad (4th generation)", 264, False, False, False, False, False, False, False, False), - Device("iPadAir", "Device is an [iPad Air](https://support.apple.com/kb/SP692)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP692/SP692-specs_color-mul.png", ["iPad4,1", "iPad4,2", "iPad4,3"], 9.7, (3, 4), "iPad Air", 264, False, False, False, False, False, False, False, False), - Device("iPadAir2", "Device is an [iPad Air 2](https://support.apple.com/kb/SP708)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP708/SP708-space_gray.jpeg", ["iPad5,3", "iPad5,4"], 9.7, (3, 4), "iPad Air 2", 264, False, False, False, False, True, False, False, False), - Device("iPad5", "Device is an [iPad (5th generation)](https://support.apple.com/kb/SP751)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP751/ipad_5th_generation.png", ["iPad6,11", "iPad6,12"], 9.7, (3, 4), "iPad (5th generation)", 264, False, False, False, False, True, False, False, False), - Device("iPad6", "Device is an [iPad (6th generation)](https://support.apple.com/kb/NotYetAvailable)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP751/ipad_5th_generation.png", ["iPad7,5", "iPad7,6"], 9.7, (3, 4), "iPad (6th generation)", 264, False, False, False, False, True, False, False, False), - Device("iPadAir3", "Device is an [iPad Air (3rd generation)](INSERT LINK)", "https://store.storeimages.cdn-apple.com/4982/as-images.apple.com/is/image/AppleInc/aos/published/images/i/pa/ipad/mini/ipad-mini-compare-201903", ["iPad11,3", "iPad11,4"], 10.5, (3, 4), "iPad Air (3rd generation)", 264, False, False, False, False, True, False, False, False), - Device("iPadMini", "Device is an [iPad Mini](https://support.apple.com/kb/SP661)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP661/sp661_ipad_mini_color.jpg", ["iPad2,5", "iPad2,6", "iPad2,7"], 7.9, (3, 4), "iPad Mini", 163, False, True, False, False, False, False, False, False), - Device("iPadMini2", "Device is an [iPad Mini 2](https://support.apple.com/kb/SP693)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP693/SP693-specs_color-mul.png", ["iPad4,4", "iPad4,5", "iPad4,6"], 7.9, (3, 4), "iPad Mini 2", 326, False, True, False, False, False, False, False, False), - Device("iPadMini3", "Device is an [iPad Mini 3](https://support.apple.com/kb/SP709)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP709/SP709-space_gray.jpeg", ["iPad4,7", "iPad4,8", "iPad4,9"], 7.9, (3, 4), "iPad Mini 3", 326, False, True, False, False, True, False, False, False), - Device("iPadMini4", "Device is an [iPad Mini 4](https://support.apple.com/kb/SP725)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP725/SP725ipad-mini-4.png", ["iPad5,1", "iPad5,2"], 7.9, (3, 4), "iPad Mini 4", 326, False, True, False, False, True, False, False, False), - Device("iPadMini5", "Device is an [iPad Mini (5th generation)](INSERT LINK)", "https://store.storeimages.cdn-apple.com/4982/as-images.apple.com/is/image/AppleInc/aos/published/images/i/pa/ipad/air/ipad-air-compare-201903", ["iPad11,1", "iPad11,2"], 7.9, (3, 4), "iPad Mini (5th generation)", 326, False, True, False, False, True, False, False, False), - Device("iPadPro9Inch", "Device is an [iPad Pro 9.7-inch](https://support.apple.com/kb/SP739)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP739/SP739.png", ["iPad6,3", "iPad6,4"], 9.7, (3, 4), "iPad Pro (9.7-inch)", 264, False, False, True, False, True, False, False, False), - Device("iPadPro12Inch", "Device is an [iPad Pro 12-inch](https://support.apple.com/kb/sp723)", "http://images.apple.com/v/ipad-pro/c/images/shared/buystrip/ipad_pro_large_2x.png", ["iPad6,7", "iPad6,8"], 12.9, (3, 4), "iPad Pro (12.9-inch)", 264, False, False, True, False, True, False, False, False), - Device("iPadPro12Inch2", "Device is an [iPad Pro 12-inch (2nd generation)](https://support.apple.com/kb/SP761)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP761/ipad-pro-12in-hero-201706.png", ["iPad7,1", "iPad7,2"], 12.9, (3, 4), "iPad Pro (12.9-inch) (2nd generation)", 264, False, False, True, False, True, False, False, False), - Device("iPadPro10Inch", "Device is an [iPad Pro 10.5-inch](https://support.apple.com/kb/SP762)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP761/ipad-pro-10in-hero-201706.png", ["iPad7,3", "iPad7,4"], 10.5, (3, 4), "iPad Pro (10.5-inch)", 264, False, False, True, False, True, False, False, False), - Device("iPadPro11Inch", "Device is an [iPad Pro 11-inch](https://support.apple.com/kb/not-published-yet)", "https://support.apple.com/not-published-yet", ["iPad8,1", "iPad8,2", "iPad8,3", "iPad8,4"], 11.0, (139, 199), "iPad Pro (11-inch)", 264, False, False, True, False, False, True, False, True), - Device("iPadPro12Inch3", "Device is an [iPad Pro 12.9-inch (3rd generation)](https://support.apple.com/kb/not-published-yet)", "https://support.apple.com/not-published-yet", ["iPad8,5", "iPad8,6", "iPad8,7", "iPad8,8"], 12.9, (512, 683), "iPad Pro (12.9-inch) (3rd generation)", 264, False, False, True, False, False, True, False, True) + Device("iPad2", "Device is an [iPad 2](https://support.apple.com/kb/SP622)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP622/SP622_01-ipad2-mul.png", ["iPad2,1", "iPad2,2", "iPad2,3", "iPad2,4"], 9.7, (3, 4), "iPad 2", 132, False, False, False, False, False, False, False, False), + Device("iPad3", "Device is an [iPad (3rd generation)](https://support.apple.com/kb/SP647)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP662/sp662_ipad-4th-gen_color.jpg", ["iPad3,1", "iPad3,2", "iPad3,3"], 9.7, (3, 4), "iPad (3rd generation)", 264, False, False, False, False, False, False, False, False), + Device("iPad4", "Device is an [iPad (4th generation)](https://support.apple.com/kb/SP662)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP662/sp662_ipad-4th-gen_color.jpg", ["iPad3,4", "iPad3,5", "iPad3,6"], 9.7, (3, 4), "iPad (4th generation)", 264, False, False, False, False, False, False, False, False), + Device("iPadAir", "Device is an [iPad Air](https://support.apple.com/kb/SP692)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP692/SP692-specs_color-mul.png", ["iPad4,1", "iPad4,2", "iPad4,3"], 9.7, (3, 4), "iPad Air", 264, False, False, False, False, False, False, False, False), + Device("iPadAir2", "Device is an [iPad Air 2](https://support.apple.com/kb/SP708)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP708/SP708-space_gray.jpeg", ["iPad5,3", "iPad5,4"], 9.7, (3, 4), "iPad Air 2", 264, False, False, False, False, True, False, False, False), + Device("iPad5", "Device is an [iPad (5th generation)](https://support.apple.com/kb/SP751)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP751/ipad_5th_generation.png", ["iPad6,11", "iPad6,12"], 9.7, (3, 4), "iPad (5th generation)", 264, False, False, False, False, True, False, False, False), + Device("iPad6", "Device is an [iPad (6th generation)](https://support.apple.com/kb/NotYetAvailable)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP751/ipad_5th_generation.png", ["iPad7,5", "iPad7,6"], 9.7, (3, 4), "iPad (6th generation)", 264, False, False, False, False, True, False, False, False), + Device("iPadAir3", "Device is an [iPad Air (3rd generation)](INSERT LINK)", "https://store.storeimages.cdn-apple.com/4982/as-images.apple.com/is/image/AppleInc/aos/published/images/i/pa/ipad/mini/ipad-mini-compare-201903", ["iPad11,3", "iPad11,4"], 10.5, (3, 4), "iPad Air (3rd generation)", 264, False, False, False, False, True, False, False, False), + Device("iPadMini", "Device is an [iPad Mini](https://support.apple.com/kb/SP661)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP661/sp661_ipad_mini_color.jpg", ["iPad2,5", "iPad2,6", "iPad2,7"], 7.9, (3, 4), "iPad Mini", 163, False, True, False, False, False, False, False, False), + Device("iPadMini2", "Device is an [iPad Mini 2](https://support.apple.com/kb/SP693)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP693/SP693-specs_color-mul.png", ["iPad4,4", "iPad4,5", "iPad4,6"], 7.9, (3, 4), "iPad Mini 2", 326, False, True, False, False, False, False, False, False), + Device("iPadMini3", "Device is an [iPad Mini 3](https://support.apple.com/kb/SP709)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP709/SP709-space_gray.jpeg", ["iPad4,7", "iPad4,8", "iPad4,9"], 7.9, (3, 4), "iPad Mini 3", 326, False, True, False, False, True, False, False, False), + Device("iPadMini4", "Device is an [iPad Mini 4](https://support.apple.com/kb/SP725)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP725/SP725ipad-mini-4.png", ["iPad5,1", "iPad5,2"], 7.9, (3, 4), "iPad Mini 4", 326, False, True, False, False, True, False, False, False), + Device("iPadMini5", "Device is an [iPad Mini (5th generation)](INSERT LINK)", "https://store.storeimages.cdn-apple.com/4982/as-images.apple.com/is/image/AppleInc/aos/published/images/i/pa/ipad/air/ipad-air-compare-201903", ["iPad11,1", "iPad11,2"], 7.9, (3, 4), "iPad Mini (5th generation)", 326, False, True, False, False, True, False, False, False), + Device("iPadPro9Inch", "Device is an [iPad Pro 9.7-inch](https://support.apple.com/kb/SP739)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP739/SP739.png", ["iPad6,3", "iPad6,4"], 9.7, (3, 4), "iPad Pro (9.7-inch)", 264, False, False, True, False, True, False, False, False), + Device("iPadPro12Inch", "Device is an [iPad Pro 12-inch](https://support.apple.com/kb/sp723)", "http://images.apple.com/v/ipad-pro/c/images/shared/buystrip/ipad_pro_large_2x.png", ["iPad6,7", "iPad6,8"], 12.9, (3, 4), "iPad Pro (12.9-inch)", 264, False, False, True, False, True, False, False, False), + Device("iPadPro12Inch2", "Device is an [iPad Pro 12-inch (2nd generation)](https://support.apple.com/kb/SP761)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP761/ipad-pro-12in-hero-201706.png", ["iPad7,1", "iPad7,2"], 12.9, (3, 4), "iPad Pro (12.9-inch) (2nd generation)", 264, False, False, True, False, True, False, False, False), + Device("iPadPro10Inch", "Device is an [iPad Pro 10.5-inch](https://support.apple.com/kb/SP762)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP761/ipad-pro-10in-hero-201706.png", ["iPad7,3", "iPad7,4"], 10.5, (3, 4), "iPad Pro (10.5-inch)", 264, False, False, True, False, True, False, False, False), + Device("iPadPro11Inch", "Device is an [iPad Pro 11-inch](https://support.apple.com/kb/not-published-yet)", "https://support.apple.com/not-published-yet", ["iPad8,1", "iPad8,2", "iPad8,3", "iPad8,4"], 11.0, (139, 199), "iPad Pro (11-inch)", 264, False, False, True, False, False, True, False, True), + Device("iPadPro12Inch3", "Device is an [iPad Pro 12.9-inch (3rd generation)](https://support.apple.com/kb/not-published-yet)", "https://support.apple.com/not-published-yet", ["iPad8,5", "iPad8,6", "iPad8,7", "iPad8,8"], 12.9, (512, 683), "iPad Pro (12.9-inch) (3rd generation)", 264, False, False, True, False, False, True, False, True) ] homePods = [ - Device("homePod", "Device is a [HomePod](https://www.apple.com/homepod/)", "https://images.apple.com/v/homepod/d/images/overview/homepod_side_dark_large_2x.jpg", ["AudioAccessory1,1"], -1, (4, 5), "HomePod", -1, False, False, False, False, False, False, False, False), + Device("homePod", "Device is a [HomePod](https://www.apple.com/homepod/)", "https://images.apple.com/v/homepod/d/images/overview/homepod_side_dark_large_2x.jpg", ["AudioAccessory1,1"], -1, (4, 5), "HomePod", -1, False, False, False, False, False, False, False, False), ] # tvOS tvs = [ - Device("appleTV4", "Device is an [Apple TV 4](https://support.apple.com/kb/SP724)", "http://images.apple.com/v/tv/c/images/overview/buy_tv_large_2x.jpg", ["AppleTV5,3"], 0, (), "Apple TV 4", -1, False, False, False, False, False, False, False, False), - Device("appleTV4K", "Device is an [Apple TV 4K](https://support.apple.com/kb/SP769)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP769/appletv4k.png", ["AppleTV6,2"], 0, (), "Apple TV 4K", -1, False, False, False, False, False, False, False, False) + Device("appleTV4", "Device is an [Apple TV 4](https://support.apple.com/kb/SP724)", "http://images.apple.com/v/tv/c/images/overview/buy_tv_large_2x.jpg", ["AppleTV5,3"], 0, (), "Apple TV 4", -1, False, False, False, False, False, False, False, False), + Device("appleTV4K", "Device is an [Apple TV 4K](https://support.apple.com/kb/SP769)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP769/appletv4k.png", ["AppleTV6,2"], 0, (), "Apple TV 4K", -1, False, False, False, False, False, False, False, False) ] # watchOS From 149fc520e9b9118e2aedac8eab4859b3fe6c57be Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Fri, 29 Mar 2019 20:02:23 +0100 Subject: [PATCH 29/41] Fixed trailing whitespace violations. --- Source/Device.generated.swift | 4 ++-- Source/Device.swift.gyb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Device.generated.swift b/Source/Device.generated.swift index 5348ebbe..31d79fec 100644 --- a/Source/Device.generated.swift +++ b/Source/Device.generated.swift @@ -269,7 +269,7 @@ public enum Device { /// You can still use this enum as before but the description equals the identifier (you can get multiple identifiers for the same product class /// (e.g. "iPhone6,1" or "iPhone 6,2" do both mean "iPhone 5s")) case unknown(String) - + /// Returns a `Device` representing the current device this software runs on. public static var current: Device { return Device.mapToDevice(identifier: Device.identifier) @@ -742,7 +742,7 @@ public enum Device { public func isOneOf(_ devices: [Device]) -> Bool { return devices.contains(self) } - + /// Whether or not the current device is the current device. private var isCurrent: Bool { return self == Device.current diff --git a/Source/Device.swift.gyb b/Source/Device.swift.gyb index 722e6565..bedf26d0 100644 --- a/Source/Device.swift.gyb +++ b/Source/Device.swift.gyb @@ -235,7 +235,7 @@ public enum Device { /// You can still use this enum as before but the description equals the identifier (you can get multiple identifiers for the same product class /// (e.g. "iPhone6,1" or "iPhone 6,2" do both mean "iPhone 5s")) case unknown(String) - + /// Returns a `Device` representing the current device this software runs on. public static var current: Device { return Device.mapToDevice(identifier: Device.identifier) @@ -577,7 +577,7 @@ public enum Device { public func isOneOf(_ devices: [Device]) -> Bool { return devices.contains(self) } - + /// Whether or not the current device is the current device. private var isCurrent: Bool { return self == Device.current From 93dcd671fe7618c7756009494c020d158f1b41b3 Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Fri, 29 Mar 2019 20:03:49 +0100 Subject: [PATCH 30/41] Disable the function_body_length rule on mapToDevice(String). Since this function is generated with a switch for all devices, this needs to be this long. --- Source/Device.generated.swift | 2 +- Source/Device.swift.gyb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Device.generated.swift b/Source/Device.generated.swift index 31d79fec..fb28da6f 100644 --- a/Source/Device.generated.swift +++ b/Source/Device.generated.swift @@ -293,7 +293,7 @@ public enum Device { /// - parameter identifier: The device identifier, e.g. "iPhone7,1". Can be obtained from `Device.identifier`. /// /// - returns: An initialized `Device`. - public static func mapToDevice(identifier: String) -> Device { // swiftlint:disable:this cyclomatic_complexity + public static func mapToDevice(identifier: String) -> Device { // swiftlint:disable:this cyclomatic_complexity function_body_length #if os(iOS) switch identifier { case "iPod5,1": return iPodTouch5 diff --git a/Source/Device.swift.gyb b/Source/Device.swift.gyb index bedf26d0..3017ff85 100644 --- a/Source/Device.swift.gyb +++ b/Source/Device.swift.gyb @@ -259,7 +259,7 @@ public enum Device { /// - parameter identifier: The device identifier, e.g. "iPhone7,1". Can be obtained from `Device.identifier`. /// /// - returns: An initialized `Device`. - public static func mapToDevice(identifier: String) -> Device { // swiftlint:disable:this cyclomatic_complexity + public static func mapToDevice(identifier: String) -> Device { // swiftlint:disable:this cyclomatic_complexity function_body_length #if os(iOS) switch identifier { % for device in iOSDevices: From 123a95037cfcf6316ee8b94256ba8be522016cc7 Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Fri, 29 Mar 2019 20:09:52 +0100 Subject: [PATCH 31/41] Use Xcode 10.2 to build and test the project. This is required because Swift 5 isn't supported in Xcode 10.1. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 49137279..c42b881f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: objective-c -osx_image: xcode10.1 +osx_image: xcode10.2 env: - DESTINATION='platform=iOS Simulator,name=iPad (5th generation)' From dbe45bd5aa279718487ee023d3b2d92cc5e87e11 Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Fri, 29 Mar 2019 23:44:11 +0100 Subject: [PATCH 32/41] Set .swift-version to 5.0 --- .swift-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.swift-version b/.swift-version index bf77d549..819e07a2 100644 --- a/.swift-version +++ b/.swift-version @@ -1 +1 @@ -4.2 +5.0 From a0601cddb613a9a7f50ba4aafad11a5b3f47b8fa Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Sat, 30 Mar 2019 12:53:08 +0100 Subject: [PATCH 33/41] Fixed description tests. --- Tests/Tests.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Tests/Tests.swift b/Tests/Tests.swift index 8035771d..55358e2c 100644 --- a/Tests/Tests.swift +++ b/Tests/Tests.swift @@ -230,11 +230,11 @@ class DeviceKitTests: XCTestCase { XCTAssertEqual(Device.iPhoneXSMax.description, "iPhone Xs Max") XCTAssertEqual(Device.iPhoneXR.description, "iPhone Xʀ") XCTAssertEqual(Device.iPad2.description, "iPad 2") - XCTAssertEqual(Device.iPad3.description, "iPad 3") - XCTAssertEqual(Device.iPad4.description, "iPad 4") + XCTAssertEqual(Device.iPad3.description, "iPad (3rd generation)") + XCTAssertEqual(Device.iPad4.description, "iPad (4th generation)") XCTAssertEqual(Device.iPadAir.description, "iPad Air") XCTAssertEqual(Device.iPadAir2.description, "iPad Air 2") - XCTAssertEqual(Device.iPad5.description, "iPad 5") + XCTAssertEqual(Device.iPad5.description, "iPad (5th generation)") XCTAssertEqual(Device.iPadMini.description, "iPad Mini") XCTAssertEqual(Device.iPadMini2.description, "iPad Mini 2") XCTAssertEqual(Device.iPadMini3.description, "iPad Mini 3") From e8448b92bb9ad0e65466a12a750dc079c297844d Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Sat, 30 Mar 2019 12:53:37 +0100 Subject: [PATCH 34/41] Add iPad (6th gen), iPad Air (3rd gen) and iPad Mini (5th gen) to the description test. --- Tests/Tests.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Tests/Tests.swift b/Tests/Tests.swift index 55358e2c..76241647 100644 --- a/Tests/Tests.swift +++ b/Tests/Tests.swift @@ -235,10 +235,13 @@ class DeviceKitTests: XCTestCase { XCTAssertEqual(Device.iPadAir.description, "iPad Air") XCTAssertEqual(Device.iPadAir2.description, "iPad Air 2") XCTAssertEqual(Device.iPad5.description, "iPad (5th generation)") + XCTAssertEqual(Device.iPad6.description, "iPad (6th generation)") + XCTAssertEqual(Device.iPadAir3.description, "iPad Air (3rd generation)") XCTAssertEqual(Device.iPadMini.description, "iPad Mini") XCTAssertEqual(Device.iPadMini2.description, "iPad Mini 2") XCTAssertEqual(Device.iPadMini3.description, "iPad Mini 3") XCTAssertEqual(Device.iPadMini4.description, "iPad Mini 4") + XCTAssertEqual(Device.iPadMini5.description, "iPad Mini (5th generation)") XCTAssertEqual(Device.iPadPro9Inch.description, "iPad Pro (9.7-inch)") XCTAssertEqual(Device.iPadPro12Inch.description, "iPad Pro (12.9-inch)") XCTAssertEqual(Device.iPadPro12Inch2.description, "iPad Pro (12.9-inch) (2nd generation)") From 416e76416f90e8dbc08669062b9d246a8f5ab8b2 Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Sat, 30 Mar 2019 12:54:34 +0100 Subject: [PATCH 35/41] Fixed one test that still used Device(). --- Tests/Tests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/Tests.swift b/Tests/Tests.swift index 76241647..bd99175f 100644 --- a/Tests/Tests.swift +++ b/Tests/Tests.swift @@ -368,7 +368,7 @@ class DeviceKitTests: XCTestCase { // MARK: - tvOS #if os(tvOS) func testIsSimulator() { - XCTAssertTrue(Device().isOneOf(Device.allSimulatorTVs)) + XCTAssertTrue(Device.current.isOneOf(Device.allSimulatorTVs)) } func testDescriptionFromIdentifier() { From 3526e3f2709ced388bcef03bb7613b5f19403c21 Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Sat, 30 Mar 2019 13:04:41 +0100 Subject: [PATCH 36/41] Created new test to prevent https://github.com/devicekit/DeviceKit/issues/165 from happening again. --- Tests/Tests.swift | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Tests/Tests.swift b/Tests/Tests.swift index bd99175f..c33727eb 100644 --- a/Tests/Tests.swift +++ b/Tests/Tests.swift @@ -34,6 +34,27 @@ class DeviceKitTests: XCTestCase { XCTAssertTrue(device.isSimulator) } + func testIsPhoneIsPad() { + // Test for https://github.com/devicekit/DeviceKit/issues/165 to prevent it from happening in the future. + + if UIDevice.current.userInterfaceIdiom == .pad { + XCTAssertTrue(device.isPad) + XCTAssertFalse(device.isPhone) + } else if UIDevice.current.userInterfaceIdiom == .phone { + XCTAssertFalse(device.isPad) + XCTAssertTrue(device.isPhone) + } + + for pad in Device.allPads { + XCTAssertTrue(pad.isPad) + XCTAssertFalse(pad.isPhone) + } + for phone in Device.allPhones { + XCTAssertFalse(phone.isPad) + XCTAssertTrue(phone.isPhone) + } + } + func testBattery() { XCTAssertTrue(Device.BatteryState.full > Device.BatteryState.charging(100)) XCTAssertTrue(Device.BatteryState.charging(75) != Device.BatteryState.unplugged(75)) From 568996314afc366473e3936097430bf058cbdbc3 Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Sat, 30 Mar 2019 13:09:42 +0100 Subject: [PATCH 37/41] Disable the function_body_length swiftlint rule on the testDescription(). --- Tests/Tests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/Tests.swift b/Tests/Tests.swift index c33727eb..86a5d2c2 100644 --- a/Tests/Tests.swift +++ b/Tests/Tests.swift @@ -229,7 +229,7 @@ class DeviceKitTests: XCTestCase { XCTAssertEqual(Device.unknown(UUID().uuidString).diagonal, -1) } - func testDescription() { + func testDescription() { // swiftlint:disable:this function_body_length XCTAssertEqual(Device.iPodTouch5.description, "iPod Touch 5") XCTAssertEqual(Device.iPodTouch6.description, "iPod Touch 6") XCTAssertEqual(Device.iPhone4.description, "iPhone 4") From ea46929df3cbddb2561887051033a145e15ae0be Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Sat, 30 Mar 2019 21:52:14 +0100 Subject: [PATCH 38/41] Added a bunch of tech specs and image links where missing. --- Source/Device.generated.swift | 18 +++++++++--------- Source/Device.swift.gyb | 10 +++++----- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Source/Device.generated.swift b/Source/Device.generated.swift index fb28da6f..4d754b69 100644 --- a/Source/Device.generated.swift +++ b/Source/Device.generated.swift @@ -152,13 +152,13 @@ public enum Device { /// /// ![Image](https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP751/ipad_5th_generation.png) case iPad5 - /// Device is an [iPad (6th generation)](https://support.apple.com/kb/NotYetAvailable) + /// Device is an [iPad (6th generation)](https://support.apple.com/kb/SP774) /// /// ![Image](https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP751/ipad_5th_generation.png) case iPad6 - /// Device is an [iPad Air (3rd generation)](INSERT LINK) + /// Device is an [iPad Air (3rd generation)](https://support.apple.com/kb/SP787) /// - /// ![Image](https://store.storeimages.cdn-apple.com/4982/as-images.apple.com/is/image/AppleInc/aos/published/images/i/pa/ipad/mini/ipad-mini-compare-201903) + /// ![Image](https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP787/ipad-air-2019.jpg) case iPadAir3 /// Device is an [iPad Mini](https://support.apple.com/kb/SP661) /// @@ -176,9 +176,9 @@ public enum Device { /// /// ![Image](https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP725/SP725ipad-mini-4.png) case iPadMini4 - /// Device is an [iPad Mini (5th generation)](INSERT LINK) + /// Device is an [iPad Mini (5th generation)](https://support.apple.com/kb/SP788) /// - /// ![Image](https://store.storeimages.cdn-apple.com/4982/as-images.apple.com/is/image/AppleInc/aos/published/images/i/pa/ipad/air/ipad-air-compare-201903) + /// ![Image](https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP788/ipad-mini-2019.jpg) case iPadMini5 /// Device is an [iPad Pro 9.7-inch](https://support.apple.com/kb/SP739) /// @@ -196,13 +196,13 @@ public enum Device { /// /// ![Image](https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP761/ipad-pro-10in-hero-201706.png) case iPadPro10Inch - /// Device is an [iPad Pro 11-inch](https://support.apple.com/kb/not-published-yet) + /// Device is an [iPad Pro 11-inch](https://support.apple.com/kb/SP784) /// - /// ![Image](https://support.apple.com/not-published-yet) + /// ![Image](https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP784/ipad-pro-11-2018_2x.png) case iPadPro11Inch - /// Device is an [iPad Pro 12.9-inch (3rd generation)](https://support.apple.com/kb/not-published-yet) + /// Device is an [iPad Pro 12.9-inch (3rd generation)](https://support.apple.com/kb/SP785) /// - /// ![Image](https://support.apple.com/not-published-yet) + /// ![Image](https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP785/ipad-pro-12-2018_2x.png) case iPadPro12Inch3 /// Device is a [HomePod](https://www.apple.com/homepod/) /// diff --git a/Source/Device.swift.gyb b/Source/Device.swift.gyb index 3017ff85..7c3f25a7 100644 --- a/Source/Device.swift.gyb +++ b/Source/Device.swift.gyb @@ -64,19 +64,19 @@ iPads = [ Device("iPadAir", "Device is an [iPad Air](https://support.apple.com/kb/SP692)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP692/SP692-specs_color-mul.png", ["iPad4,1", "iPad4,2", "iPad4,3"], 9.7, (3, 4), "iPad Air", 264, False, False, False, False, False, False, False, False), Device("iPadAir2", "Device is an [iPad Air 2](https://support.apple.com/kb/SP708)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP708/SP708-space_gray.jpeg", ["iPad5,3", "iPad5,4"], 9.7, (3, 4), "iPad Air 2", 264, False, False, False, False, True, False, False, False), Device("iPad5", "Device is an [iPad (5th generation)](https://support.apple.com/kb/SP751)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP751/ipad_5th_generation.png", ["iPad6,11", "iPad6,12"], 9.7, (3, 4), "iPad (5th generation)", 264, False, False, False, False, True, False, False, False), - Device("iPad6", "Device is an [iPad (6th generation)](https://support.apple.com/kb/NotYetAvailable)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP751/ipad_5th_generation.png", ["iPad7,5", "iPad7,6"], 9.7, (3, 4), "iPad (6th generation)", 264, False, False, False, False, True, False, False, False), - Device("iPadAir3", "Device is an [iPad Air (3rd generation)](INSERT LINK)", "https://store.storeimages.cdn-apple.com/4982/as-images.apple.com/is/image/AppleInc/aos/published/images/i/pa/ipad/mini/ipad-mini-compare-201903", ["iPad11,3", "iPad11,4"], 10.5, (3, 4), "iPad Air (3rd generation)", 264, False, False, False, False, True, False, False, False), + Device("iPad6", "Device is an [iPad (6th generation)](https://support.apple.com/kb/SP774)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP751/ipad_5th_generation.png", ["iPad7,5", "iPad7,6"], 9.7, (3, 4), "iPad (6th generation)", 264, False, False, False, False, True, False, False, False), + Device("iPadAir3", "Device is an [iPad Air (3rd generation)](https://support.apple.com/kb/SP787)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP787/ipad-air-2019.jpg", ["iPad11,3", "iPad11,4"], 10.5, (3, 4), "iPad Air (3rd generation)", 264, False, False, False, False, True, False, False, False), Device("iPadMini", "Device is an [iPad Mini](https://support.apple.com/kb/SP661)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP661/sp661_ipad_mini_color.jpg", ["iPad2,5", "iPad2,6", "iPad2,7"], 7.9, (3, 4), "iPad Mini", 163, False, True, False, False, False, False, False, False), Device("iPadMini2", "Device is an [iPad Mini 2](https://support.apple.com/kb/SP693)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP693/SP693-specs_color-mul.png", ["iPad4,4", "iPad4,5", "iPad4,6"], 7.9, (3, 4), "iPad Mini 2", 326, False, True, False, False, False, False, False, False), Device("iPadMini3", "Device is an [iPad Mini 3](https://support.apple.com/kb/SP709)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP709/SP709-space_gray.jpeg", ["iPad4,7", "iPad4,8", "iPad4,9"], 7.9, (3, 4), "iPad Mini 3", 326, False, True, False, False, True, False, False, False), Device("iPadMini4", "Device is an [iPad Mini 4](https://support.apple.com/kb/SP725)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP725/SP725ipad-mini-4.png", ["iPad5,1", "iPad5,2"], 7.9, (3, 4), "iPad Mini 4", 326, False, True, False, False, True, False, False, False), - Device("iPadMini5", "Device is an [iPad Mini (5th generation)](INSERT LINK)", "https://store.storeimages.cdn-apple.com/4982/as-images.apple.com/is/image/AppleInc/aos/published/images/i/pa/ipad/air/ipad-air-compare-201903", ["iPad11,1", "iPad11,2"], 7.9, (3, 4), "iPad Mini (5th generation)", 326, False, True, False, False, True, False, False, False), + Device("iPadMini5", "Device is an [iPad Mini (5th generation)](https://support.apple.com/kb/SP788)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP788/ipad-mini-2019.jpg", ["iPad11,1", "iPad11,2"], 7.9, (3, 4), "iPad Mini (5th generation)", 326, False, True, False, False, True, False, False, False), Device("iPadPro9Inch", "Device is an [iPad Pro 9.7-inch](https://support.apple.com/kb/SP739)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP739/SP739.png", ["iPad6,3", "iPad6,4"], 9.7, (3, 4), "iPad Pro (9.7-inch)", 264, False, False, True, False, True, False, False, False), Device("iPadPro12Inch", "Device is an [iPad Pro 12-inch](https://support.apple.com/kb/sp723)", "http://images.apple.com/v/ipad-pro/c/images/shared/buystrip/ipad_pro_large_2x.png", ["iPad6,7", "iPad6,8"], 12.9, (3, 4), "iPad Pro (12.9-inch)", 264, False, False, True, False, True, False, False, False), Device("iPadPro12Inch2", "Device is an [iPad Pro 12-inch (2nd generation)](https://support.apple.com/kb/SP761)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP761/ipad-pro-12in-hero-201706.png", ["iPad7,1", "iPad7,2"], 12.9, (3, 4), "iPad Pro (12.9-inch) (2nd generation)", 264, False, False, True, False, True, False, False, False), Device("iPadPro10Inch", "Device is an [iPad Pro 10.5-inch](https://support.apple.com/kb/SP762)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP761/ipad-pro-10in-hero-201706.png", ["iPad7,3", "iPad7,4"], 10.5, (3, 4), "iPad Pro (10.5-inch)", 264, False, False, True, False, True, False, False, False), - Device("iPadPro11Inch", "Device is an [iPad Pro 11-inch](https://support.apple.com/kb/not-published-yet)", "https://support.apple.com/not-published-yet", ["iPad8,1", "iPad8,2", "iPad8,3", "iPad8,4"], 11.0, (139, 199), "iPad Pro (11-inch)", 264, False, False, True, False, False, True, False, True), - Device("iPadPro12Inch3", "Device is an [iPad Pro 12.9-inch (3rd generation)](https://support.apple.com/kb/not-published-yet)", "https://support.apple.com/not-published-yet", ["iPad8,5", "iPad8,6", "iPad8,7", "iPad8,8"], 12.9, (512, 683), "iPad Pro (12.9-inch) (3rd generation)", 264, False, False, True, False, False, True, False, True) + Device("iPadPro11Inch", "Device is an [iPad Pro 11-inch](https://support.apple.com/kb/SP784)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP784/ipad-pro-11-2018_2x.png", ["iPad8,1", "iPad8,2", "iPad8,3", "iPad8,4"], 11.0, (139, 199), "iPad Pro (11-inch)", 264, False, False, True, False, False, True, False, True), + Device("iPadPro12Inch3", "Device is an [iPad Pro 12.9-inch (3rd generation)](https://support.apple.com/kb/SP785)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP785/ipad-pro-12-2018_2x.png", ["iPad8,5", "iPad8,6", "iPad8,7", "iPad8,8"], 12.9, (512, 683), "iPad Pro (12.9-inch) (3rd generation)", 264, False, False, True, False, False, True, False, True) ] From 36671121887138cd63db6e22d5b2138c815a379b Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Sat, 30 Mar 2019 22:00:29 +0100 Subject: [PATCH 39/41] Fixed spacing and another couple urls. --- Source/Device.generated.swift | 8 +++---- Source/Device.swift.gyb | 44 +++++++++++++++++------------------ 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Source/Device.generated.swift b/Source/Device.generated.swift index 4d754b69..242c23b5 100644 --- a/Source/Device.generated.swift +++ b/Source/Device.generated.swift @@ -184,9 +184,9 @@ public enum Device { /// /// ![Image](https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP739/SP739.png) case iPadPro9Inch - /// Device is an [iPad Pro 12-inch](https://support.apple.com/kb/sp723) + /// Device is an [iPad Pro 12-inch](https://support.apple.com/kb/SP723) /// - /// ![Image](http://images.apple.com/v/ipad-pro/c/images/shared/buystrip/ipad_pro_large_2x.png) + /// ![Image](https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP723/SP723-iPad_Pro_2x.png) case iPadPro12Inch /// Device is an [iPad Pro 12-inch (2nd generation)](https://support.apple.com/kb/SP761) /// @@ -204,9 +204,9 @@ public enum Device { /// /// ![Image](https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP785/ipad-pro-12-2018_2x.png) case iPadPro12Inch3 - /// Device is a [HomePod](https://www.apple.com/homepod/) + /// Device is a [HomePod](https://support.apple.com/kb/SP773) /// - /// ![Image](https://images.apple.com/v/homepod/d/images/overview/homepod_side_dark_large_2x.jpg) + /// ![Image](https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP773/homepod_space_gray_large_2x.jpg) case homePod #elseif os(tvOS) /// Device is an [Apple TV 4](https://support.apple.com/kb/SP724) diff --git a/Source/Device.swift.gyb b/Source/Device.swift.gyb index 7c3f25a7..b7557cdf 100644 --- a/Source/Device.swift.gyb +++ b/Source/Device.swift.gyb @@ -58,35 +58,35 @@ iPhones = [ ] iPads = [ - Device("iPad2", "Device is an [iPad 2](https://support.apple.com/kb/SP622)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP622/SP622_01-ipad2-mul.png", ["iPad2,1", "iPad2,2", "iPad2,3", "iPad2,4"], 9.7, (3, 4), "iPad 2", 132, False, False, False, False, False, False, False, False), - Device("iPad3", "Device is an [iPad (3rd generation)](https://support.apple.com/kb/SP647)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP662/sp662_ipad-4th-gen_color.jpg", ["iPad3,1", "iPad3,2", "iPad3,3"], 9.7, (3, 4), "iPad (3rd generation)", 264, False, False, False, False, False, False, False, False), - Device("iPad4", "Device is an [iPad (4th generation)](https://support.apple.com/kb/SP662)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP662/sp662_ipad-4th-gen_color.jpg", ["iPad3,4", "iPad3,5", "iPad3,6"], 9.7, (3, 4), "iPad (4th generation)", 264, False, False, False, False, False, False, False, False), - Device("iPadAir", "Device is an [iPad Air](https://support.apple.com/kb/SP692)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP692/SP692-specs_color-mul.png", ["iPad4,1", "iPad4,2", "iPad4,3"], 9.7, (3, 4), "iPad Air", 264, False, False, False, False, False, False, False, False), - Device("iPadAir2", "Device is an [iPad Air 2](https://support.apple.com/kb/SP708)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP708/SP708-space_gray.jpeg", ["iPad5,3", "iPad5,4"], 9.7, (3, 4), "iPad Air 2", 264, False, False, False, False, True, False, False, False), - Device("iPad5", "Device is an [iPad (5th generation)](https://support.apple.com/kb/SP751)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP751/ipad_5th_generation.png", ["iPad6,11", "iPad6,12"], 9.7, (3, 4), "iPad (5th generation)", 264, False, False, False, False, True, False, False, False), - Device("iPad6", "Device is an [iPad (6th generation)](https://support.apple.com/kb/SP774)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP751/ipad_5th_generation.png", ["iPad7,5", "iPad7,6"], 9.7, (3, 4), "iPad (6th generation)", 264, False, False, False, False, True, False, False, False), - Device("iPadAir3", "Device is an [iPad Air (3rd generation)](https://support.apple.com/kb/SP787)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP787/ipad-air-2019.jpg", ["iPad11,3", "iPad11,4"], 10.5, (3, 4), "iPad Air (3rd generation)", 264, False, False, False, False, True, False, False, False), - Device("iPadMini", "Device is an [iPad Mini](https://support.apple.com/kb/SP661)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP661/sp661_ipad_mini_color.jpg", ["iPad2,5", "iPad2,6", "iPad2,7"], 7.9, (3, 4), "iPad Mini", 163, False, True, False, False, False, False, False, False), - Device("iPadMini2", "Device is an [iPad Mini 2](https://support.apple.com/kb/SP693)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP693/SP693-specs_color-mul.png", ["iPad4,4", "iPad4,5", "iPad4,6"], 7.9, (3, 4), "iPad Mini 2", 326, False, True, False, False, False, False, False, False), - Device("iPadMini3", "Device is an [iPad Mini 3](https://support.apple.com/kb/SP709)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP709/SP709-space_gray.jpeg", ["iPad4,7", "iPad4,8", "iPad4,9"], 7.9, (3, 4), "iPad Mini 3", 326, False, True, False, False, True, False, False, False), - Device("iPadMini4", "Device is an [iPad Mini 4](https://support.apple.com/kb/SP725)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP725/SP725ipad-mini-4.png", ["iPad5,1", "iPad5,2"], 7.9, (3, 4), "iPad Mini 4", 326, False, True, False, False, True, False, False, False), - Device("iPadMini5", "Device is an [iPad Mini (5th generation)](https://support.apple.com/kb/SP788)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP788/ipad-mini-2019.jpg", ["iPad11,1", "iPad11,2"], 7.9, (3, 4), "iPad Mini (5th generation)", 326, False, True, False, False, True, False, False, False), - Device("iPadPro9Inch", "Device is an [iPad Pro 9.7-inch](https://support.apple.com/kb/SP739)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP739/SP739.png", ["iPad6,3", "iPad6,4"], 9.7, (3, 4), "iPad Pro (9.7-inch)", 264, False, False, True, False, True, False, False, False), - Device("iPadPro12Inch", "Device is an [iPad Pro 12-inch](https://support.apple.com/kb/sp723)", "http://images.apple.com/v/ipad-pro/c/images/shared/buystrip/ipad_pro_large_2x.png", ["iPad6,7", "iPad6,8"], 12.9, (3, 4), "iPad Pro (12.9-inch)", 264, False, False, True, False, True, False, False, False), - Device("iPadPro12Inch2", "Device is an [iPad Pro 12-inch (2nd generation)](https://support.apple.com/kb/SP761)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP761/ipad-pro-12in-hero-201706.png", ["iPad7,1", "iPad7,2"], 12.9, (3, 4), "iPad Pro (12.9-inch) (2nd generation)", 264, False, False, True, False, True, False, False, False), - Device("iPadPro10Inch", "Device is an [iPad Pro 10.5-inch](https://support.apple.com/kb/SP762)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP761/ipad-pro-10in-hero-201706.png", ["iPad7,3", "iPad7,4"], 10.5, (3, 4), "iPad Pro (10.5-inch)", 264, False, False, True, False, True, False, False, False), - Device("iPadPro11Inch", "Device is an [iPad Pro 11-inch](https://support.apple.com/kb/SP784)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP784/ipad-pro-11-2018_2x.png", ["iPad8,1", "iPad8,2", "iPad8,3", "iPad8,4"], 11.0, (139, 199), "iPad Pro (11-inch)", 264, False, False, True, False, False, True, False, True), - Device("iPadPro12Inch3", "Device is an [iPad Pro 12.9-inch (3rd generation)](https://support.apple.com/kb/SP785)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP785/ipad-pro-12-2018_2x.png", ["iPad8,5", "iPad8,6", "iPad8,7", "iPad8,8"], 12.9, (512, 683), "iPad Pro (12.9-inch) (3rd generation)", 264, False, False, True, False, False, True, False, True) + Device("iPad2", "Device is an [iPad 2](https://support.apple.com/kb/SP622)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP622/SP622_01-ipad2-mul.png", ["iPad2,1", "iPad2,2", "iPad2,3", "iPad2,4"], 9.7, (3, 4), "iPad 2", 132, False, False, False, False, False, False, False, False), + Device("iPad3", "Device is an [iPad (3rd generation)](https://support.apple.com/kb/SP647)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP662/sp662_ipad-4th-gen_color.jpg", ["iPad3,1", "iPad3,2", "iPad3,3"], 9.7, (3, 4), "iPad (3rd generation)", 264, False, False, False, False, False, False, False, False), + Device("iPad4", "Device is an [iPad (4th generation)](https://support.apple.com/kb/SP662)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP662/sp662_ipad-4th-gen_color.jpg", ["iPad3,4", "iPad3,5", "iPad3,6"], 9.7, (3, 4), "iPad (4th generation)", 264, False, False, False, False, False, False, False, False), + Device("iPadAir", "Device is an [iPad Air](https://support.apple.com/kb/SP692)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP692/SP692-specs_color-mul.png", ["iPad4,1", "iPad4,2", "iPad4,3"], 9.7, (3, 4), "iPad Air", 264, False, False, False, False, False, False, False, False), + Device("iPadAir2", "Device is an [iPad Air 2](https://support.apple.com/kb/SP708)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP708/SP708-space_gray.jpeg", ["iPad5,3", "iPad5,4"], 9.7, (3, 4), "iPad Air 2", 264, False, False, False, False, True, False, False, False), + Device("iPad5", "Device is an [iPad (5th generation)](https://support.apple.com/kb/SP751)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP751/ipad_5th_generation.png", ["iPad6,11", "iPad6,12"], 9.7, (3, 4), "iPad (5th generation)", 264, False, False, False, False, True, False, False, False), + Device("iPad6", "Device is an [iPad (6th generation)](https://support.apple.com/kb/SP774)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP751/ipad_5th_generation.png", ["iPad7,5", "iPad7,6"], 9.7, (3, 4), "iPad (6th generation)", 264, False, False, False, False, True, False, False, False), + Device("iPadAir3", "Device is an [iPad Air (3rd generation)](https://support.apple.com/kb/SP787)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP787/ipad-air-2019.jpg", ["iPad11,3", "iPad11,4"], 10.5, (3, 4), "iPad Air (3rd generation)", 264, False, False, False, False, True, False, False, False), + Device("iPadMini", "Device is an [iPad Mini](https://support.apple.com/kb/SP661)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP661/sp661_ipad_mini_color.jpg", ["iPad2,5", "iPad2,6", "iPad2,7"], 7.9, (3, 4), "iPad Mini", 163, False, True, False, False, False, False, False, False), + Device("iPadMini2", "Device is an [iPad Mini 2](https://support.apple.com/kb/SP693)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP693/SP693-specs_color-mul.png", ["iPad4,4", "iPad4,5", "iPad4,6"], 7.9, (3, 4), "iPad Mini 2", 326, False, True, False, False, False, False, False, False), + Device("iPadMini3", "Device is an [iPad Mini 3](https://support.apple.com/kb/SP709)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP709/SP709-space_gray.jpeg", ["iPad4,7", "iPad4,8", "iPad4,9"], 7.9, (3, 4), "iPad Mini 3", 326, False, True, False, False, True, False, False, False), + Device("iPadMini4", "Device is an [iPad Mini 4](https://support.apple.com/kb/SP725)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP725/SP725ipad-mini-4.png", ["iPad5,1", "iPad5,2"], 7.9, (3, 4), "iPad Mini 4", 326, False, True, False, False, True, False, False, False), + Device("iPadMini5", "Device is an [iPad Mini (5th generation)](https://support.apple.com/kb/SP788)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP788/ipad-mini-2019.jpg", ["iPad11,1", "iPad11,2"], 7.9, (3, 4), "iPad Mini (5th generation)", 326, False, True, False, False, True, False, False, False), + Device("iPadPro9Inch", "Device is an [iPad Pro 9.7-inch](https://support.apple.com/kb/SP739)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP739/SP739.png", ["iPad6,3", "iPad6,4"], 9.7, (3, 4), "iPad Pro (9.7-inch)", 264, False, False, True, False, True, False, False, False), + Device("iPadPro12Inch", "Device is an [iPad Pro 12-inch](https://support.apple.com/kb/SP723)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP723/SP723-iPad_Pro_2x.png", ["iPad6,7", "iPad6,8"], 12.9, (3, 4), "iPad Pro (12.9-inch)", 264, False, False, True, False, True, False, False, False), + Device("iPadPro12Inch2", "Device is an [iPad Pro 12-inch (2nd generation)](https://support.apple.com/kb/SP761)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP761/ipad-pro-12in-hero-201706.png", ["iPad7,1", "iPad7,2"], 12.9, (3, 4), "iPad Pro (12.9-inch) (2nd generation)", 264, False, False, True, False, True, False, False, False), + Device("iPadPro10Inch", "Device is an [iPad Pro 10.5-inch](https://support.apple.com/kb/SP762)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP761/ipad-pro-10in-hero-201706.png", ["iPad7,3", "iPad7,4"], 10.5, (3, 4), "iPad Pro (10.5-inch)", 264, False, False, True, False, True, False, False, False), + Device("iPadPro11Inch", "Device is an [iPad Pro 11-inch](https://support.apple.com/kb/SP784)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP784/ipad-pro-11-2018_2x.png", ["iPad8,1", "iPad8,2", "iPad8,3", "iPad8,4"], 11.0, (139, 199), "iPad Pro (11-inch)", 264, False, False, True, False, False, True, False, True), + Device("iPadPro12Inch3", "Device is an [iPad Pro 12.9-inch (3rd generation)](https://support.apple.com/kb/SP785)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP785/ipad-pro-12-2018_2x.png", ["iPad8,5", "iPad8,6", "iPad8,7", "iPad8,8"], 12.9, (512, 683), "iPad Pro (12.9-inch) (3rd generation)", 264, False, False, True, False, False, True, False, True) ] homePods = [ - Device("homePod", "Device is a [HomePod](https://www.apple.com/homepod/)", "https://images.apple.com/v/homepod/d/images/overview/homepod_side_dark_large_2x.jpg", ["AudioAccessory1,1"], -1, (4, 5), "HomePod", -1, False, False, False, False, False, False, False, False), + Device("homePod", "Device is a [HomePod](https://support.apple.com/kb/SP773)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP773/homepod_space_gray_large_2x.jpg", ["AudioAccessory1,1"], -1, (4, 5), "HomePod", -1, False, False, False, False, False, False, False, False), ] # tvOS tvs = [ - Device("appleTV4", "Device is an [Apple TV 4](https://support.apple.com/kb/SP724)", "http://images.apple.com/v/tv/c/images/overview/buy_tv_large_2x.jpg", ["AppleTV5,3"], 0, (), "Apple TV 4", -1, False, False, False, False, False, False, False, False), - Device("appleTV4K", "Device is an [Apple TV 4K](https://support.apple.com/kb/SP769)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP769/appletv4k.png", ["AppleTV6,2"], 0, (), "Apple TV 4K", -1, False, False, False, False, False, False, False, False) + Device("appleTV4", "Device is an [Apple TV 4](https://support.apple.com/kb/SP724)", "http://images.apple.com/v/tv/c/images/overview/buy_tv_large_2x.jpg", ["AppleTV5,3"], 0, (), "Apple TV 4", -1, False, False, False, False, False, False, False, False), + Device("appleTV4K", "Device is an [Apple TV 4K](https://support.apple.com/kb/SP769)", "https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP769/appletv4k.png", ["AppleTV6,2"], 0, (), "Apple TV 4K", -1, False, False, False, False, False, False, False, False) ] # watchOS From c2a10c3d84c111b40b042ce2bb5643690aed7700 Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Mon, 1 Apr 2019 18:33:51 +0200 Subject: [PATCH 40/41] Add Swift 5 information to the readme. --- README.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5eac48c7..76c0feee 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,8 @@ | Branch | Build Status | Versions | |:---------|:--------------:|:----------:| | **master** |[![Build Status](https://travis-ci.org/devicekit/DeviceKit.svg?branch=master)](https://travis-ci.org/devicekit/DeviceKit)| - | -| **Swift 4 - 4.2** |[![Build Status](https://travis-ci.org/devicekit/DeviceKit.svg?branch=swift-4)](https://travis-ci.org/devicekit/DeviceKit)| ≥ 1.3 | +| **Swift 5** |[![Build Status](https://travis-ci.org/devicekit/DeviceKit.svg?branch=swift-5)](https://travis-ci.org/devicekit/DeviceKit)| ≥ 2.0 | +| **Swift 4 - 4.2** |[![Build Status](https://travis-ci.org/devicekit/DeviceKit.svg?branch=swift-4)](https://travis-ci.org/devicekit/DeviceKit)| ≥ 1.3 < 1.13 | | **Swift 3** |[![Build Status](https://travis-ci.org/devicekit/DeviceKit.svg?branch=swift-3)](https://travis-ci.org/devicekit/DeviceKit)| ≥ 1.0 < 1.3 | | **Swift 2.3** |[![Build Status](https://travis-ci.org/devicekit/DeviceKit.svg?branch=swift-2.3-unsupported)](https://travis-ci.org/devicekit/DeviceKit)| < 1.0 | @@ -47,6 +48,10 @@ DeviceKit can be installed in various ways. ### CocoaPods +#### Swift 5 +```ruby +pod 'DeviceKit', '~> 2.0' +``` #### Swift 4.0 - Swift 4.2 ```ruby pod 'DeviceKit', '~> 1.3' @@ -62,6 +67,10 @@ pod 'DeviceKit', :git => 'https://github.com/devicekit/DeviceKit.git', :branch = ### Carthage +#### Swift 5 +```ogdl +github "devicekit/DeviceKit" ~> 2.0 +``` #### Swift 4.0 - Swift 4.2 ```ogdl github "devicekit/DeviceKit" ~> 1.3 From 11353eb819a7a5738f5b10f56fbb911949bc96d6 Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Fri, 5 Apr 2019 08:01:40 +0200 Subject: [PATCH 41/41] Add a default case to the switch to cover future additions to WKInterfaceDeviceBatteryState. (Thanks robbiet480) --- Source/Device.generated.swift | 2 ++ Source/Device.swift.gyb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Source/Device.generated.swift b/Source/Device.generated.swift index 242c23b5..b4dfa598 100644 --- a/Source/Device.generated.swift +++ b/Source/Device.generated.swift @@ -1027,6 +1027,8 @@ extension Device { case .full: self = .full case .unplugged: self = .unplugged(batteryLevel) case .unknown: self = .full // Should never happen since `batteryMonitoring` is enabled. + @unknown default: + self = .full // To cover any future additions for which DeviceKit might not have updated yet. } WKInterfaceDevice.current().isBatteryMonitoringEnabled = wasBatteryMonitoringEnabled } diff --git a/Source/Device.swift.gyb b/Source/Device.swift.gyb index b7557cdf..9ea67c59 100644 --- a/Source/Device.swift.gyb +++ b/Source/Device.swift.gyb @@ -775,6 +775,8 @@ extension Device { case .full: self = .full case .unplugged: self = .unplugged(batteryLevel) case .unknown: self = .full // Should never happen since `batteryMonitoring` is enabled. + @unknown default: + self = .full // To cover any future additions for which DeviceKit might not have updated yet. } WKInterfaceDevice.current().isBatteryMonitoringEnabled = wasBatteryMonitoringEnabled }