Skip to content

Commit db04c81

Browse files
include iPhone 8(+) and X in the generated Swift file
1 parent 6b1479f commit db04c81

File tree

3 files changed

+32
-5
lines changed

3 files changed

+32
-5
lines changed

DeviceKit.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'DeviceKit'
3-
s.version = '1.3.0'
3+
s.version = '1.3.1'
44
s.summary = 'DeviceKit is a µ-framework that provides a value-type replacement of UIDevice.'
55

66
s.description = <<-DESC
@@ -17,7 +17,7 @@ Pod::Spec.new do |s|
1717
s.tvos.deployment_target = '9.0'
1818

1919
s.source = { :git => 'https://github.com/dennisweissmann/DeviceKit.git', :tag => s.version }
20-
s.source_files = 'Source/Device.generated.swift'
20+
s.source_files = 'Source/Device.generated.swift'
2121

2222
s.requires_arc = true
2323
end

Source/Device.generated.swift

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,18 @@ public enum Device {
100100
///
101101
/// ![Image](https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP738/SP738.png)
102102
case iPhoneSE
103+
/// Device is an [iPhone 8](https://support.apple.com/kb/SP767)
104+
///
105+
/// ![Image](https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP767/iphone8.png)
106+
case iPhone8
107+
/// Device is an [iPhone 8 Plus](https://support.apple.com/kb/SP768)
108+
///
109+
/// ![Image](https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP768/iphone8plus.png)
110+
case iPhone8Plus
111+
/// Device is an [iPhone X](https://support.apple.com/kb/SP770)
112+
///
113+
/// ![Image](https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP770/iphonex.png)
114+
case iPhoneX
103115
/// Device is an [iPad 2](https://support.apple.com/kb/SP622)
104116
///
105117
/// ![Image](https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/SP622/SP622_01-ipad2-mul.png)
@@ -213,6 +225,9 @@ public enum Device {
213225
case "iPhone9,1", "iPhone9,3": return iPhone7
214226
case "iPhone9,2", "iPhone9,4": return iPhone7Plus
215227
case "iPhone8,4": return iPhoneSE
228+
case "iPhone10,4": return iPhone8
229+
case "iPhone10,5": return iPhone8Plus
230+
case "iPhone10,3": return iPhoneX
216231
case "iPad2,1", "iPad2,2", "iPad2,3", "iPad2,4": return iPad2
217232
case "iPad3,1", "iPad3,2", "iPad3,3": return iPad3
218233
case "iPad3,4", "iPad3,5", "iPad3,6": return iPad4
@@ -247,7 +262,7 @@ public enum Device {
247262

248263
/// All iPhones
249264
public static var allPhones: [Device] {
250-
return [.iPhone4, .iPhone4s, .iPhone5, .iPhone5c, .iPhone5s, .iPhone6, .iPhone6Plus, .iPhone6s, .iPhone6sPlus, .iPhone7, .iPhone7Plus, .iPhoneSE]
265+
return [.iPhone4, .iPhone4s, .iPhone5, .iPhone5c, .iPhone5s, .iPhone6, .iPhone6Plus, .iPhone6s, .iPhone6sPlus, .iPhone7, .iPhone7Plus, .iPhoneSE, .iPhone8, .iPhone8Plus, .iPhoneX]
251266
}
252267

253268
/// All iPads
@@ -317,6 +332,9 @@ public enum Device {
317332
case .iPhone7: return 4.7
318333
case .iPhone7Plus: return 5.5
319334
case .iPhoneSE: return 4
335+
case .iPhone8: return 4.7
336+
case .iPhone8Plus: return 5.5
337+
case .iPhoneX: return 5.8
320338
case .iPad2: return 9.7
321339
case .iPad3: return 9.7
322340
case .iPad4: return 9.7
@@ -353,6 +371,9 @@ public enum Device {
353371
case .iPhone7: return (width: 9, height: 16)
354372
case .iPhone7Plus: return (width: 9, height: 16)
355373
case .iPhoneSE: return (width: 9, height: 16)
374+
case .iPhone8: return (width: 9, height: 16)
375+
case .iPhone8Plus: return (width: 9, height: 16)
376+
case .iPhoneX: return (width: 9, height: 19.5)
356377
case .iPad2: return (width: 3, height: 4)
357378
case .iPad3: return (width: 3, height: 4)
358379
case .iPad4: return (width: 3, height: 4)
@@ -404,7 +425,7 @@ public enum Device {
404425
```
405426
switch Device() {
406427
case .iPodTouch5, .iPodTouch6: callMethodOnIPods()
407-
case .iPhone4, iPhone4s, .iPhone5, .iPhone5s, .iPhone6, .iPhone6Plus, .iPhone6s, .iPhone6sPlus, .iPhone7, .iPhone7Plus, .iPhoneSE: callMethodOnIPhones()
428+
case .iPhone4, iPhone4s, .iPhone5, .iPhone5s, .iPhone6, .iPhone6Plus, .iPhone6s, .iPhone6sPlus, .iPhone7, .iPhone7Plus, .iPhoneSE, .iPhone8, .iPhone8Plus, .iPhoneX: callMethodOnIPhones()
408429
case .iPad2, .iPad3, .iPad4, .iPadAir, .iPadAir2, .iPadMini, .iPadMini2, .iPadMini3, .iPadMini4, .iPadPro: callMethodOnIPads()
409430
default: break
410431
}
@@ -473,6 +494,9 @@ public enum Device {
473494
case .iPhone7: return 326
474495
case .iPhone7Plus: return 401
475496
case .iPhoneSE: return 326
497+
case .iPhone8: return 326
498+
case .iPhone8Plus: return 401
499+
case .iPhoneX: return 458
476500
case .iPad2: return 132
477501
case .iPad3: return 264
478502
case .iPad4: return 264
@@ -517,6 +541,9 @@ extension Device: CustomStringConvertible {
517541
case .iPhone7: return "iPhone 7"
518542
case .iPhone7Plus: return "iPhone 7 Plus"
519543
case .iPhoneSE: return "iPhone SE"
544+
case .iPhone8: return "iPhone 8"
545+
case .iPhone8Plus: return "iPhone 8 Plus"
546+
case .iPhoneX: return "iPhone X"
520547
case .iPad2: return "iPad 2"
521548
case .iPad3: return "iPad 3"
522549
case .iPad4: return "iPad 4"

Source/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>1.3.0</string>
18+
<string>1.3.1</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>

0 commit comments

Comments
 (0)