From 98c3c9e397296f00cbe04deaad8e6689e00f0b1a Mon Sep 17 00:00:00 2001 From: mlch911 Date: Thu, 19 Sep 2024 14:38:09 +0800 Subject: [PATCH 1/2] Update .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 8615121..9e90bc3 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ DerivedData # Carthage/Checkouts Carthage/Build +.DS_Store From b0af56d83d7855ff6228df97779339edb7f4f02f Mon Sep 17 00:00:00 2001 From: mlch911 Date: Thu, 19 Sep 2024 14:08:18 +0800 Subject: [PATCH 2/2] Add New iPhones --- Source/Size.swift | 8 ++++++-- Source/Version.swift | 4 ++++ Source/iOS/Device.swift | 18 ++++++++++++++++-- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/Source/Size.swift b/Source/Size.swift index 2bb04d7..c374414 100644 --- a/Source/Size.swift +++ b/Source/Size.swift @@ -23,14 +23,18 @@ public enum Size: Int, Comparable { case screen5_8Inch /// iPhone Xr, 11, 12, 12 Pro, 13, 13 Pro, 14 case screen6_1Inch - /// iPhone 14 Pro, iPhone 15, iPhone 15 Pro + /// iPhone 14 Pro, iPhone 15, iPhone 15 Pro, iPhone 16 case screen6_1Inch_2 + /// iPhone 16 Pro + case screen6_3Inch /// iPhone Xs Max, 11 Pro Max case screen6_5Inch /// iPhone 12 Pro Max, 13 Pro Max, 14 Plus, 15 Plus case screen6_7Inch - /// iPhone 14 Pro Max, iPhone 15 Pro Max + /// iPhone 14 Pro Max, iPhone 15 Pro Max, iPhone 16 Plus case screen6_7Inch_2 + /// iPhone 16 Pro Max + case screen6_9Inch /// iPad Mini case screen7_9Inch /// iPad, iPad Pro (9.7-inch) diff --git a/Source/Version.swift b/Source/Version.swift index e68f393..2f2c460 100644 --- a/Source/Version.swift +++ b/Source/Version.swift @@ -50,6 +50,10 @@ public enum Version: String { case iPhone15Plus case iPhone15Pro case iPhone15Pro_Max + case iPhone16 + case iPhone16Plus + case iPhone16Pro + case iPhone16Pro_Max /*** iPad ***/ case iPad1 diff --git a/Source/iOS/Device.swift b/Source/iOS/Device.swift index 267a3d6..34e211e 100644 --- a/Source/iOS/Device.swift +++ b/Source/iOS/Device.swift @@ -64,6 +64,10 @@ open class Device { case "iPhone15,5": return .iPhone15Plus case "iPhone16,1": return .iPhone15Pro case "iPhone16,2": return .iPhone15Pro_Max + case "iPhone17,3": return .iPhone16 + case "iPhone17,4": return .iPhone16Plus + case "iPhone17,1": return .iPhone16Pro + case "iPhone17,2": return .iPhone16Pro_Max /*** iPad ***/ case "iPad1,1", "iPad1,2": return .iPad1 @@ -116,7 +120,9 @@ open class Device { /*** Simulator ***/ case "i386", "x86_64": return .simulator - default: return .unknown + default: + assertionFailure("New Device Found! Model Code:\(code). Please create a PR to the repo.") + return .unknown } } @@ -165,6 +171,8 @@ open class Device { return .screen6_1Inch case 852: return .screen6_1Inch_2 + case 874: + return .screen6_3Inch case 896: switch version() { case .iPhoneXS_Max, .iPhone11Pro_Max: @@ -176,6 +184,8 @@ open class Device { return .screen6_7Inch case 932: return .screen6_7Inch_2 + case 956: + return .screen6_9Inch case 1024: switch version() { case .iPadMini, .iPadMini2, .iPadMini3, .iPadMini4, .iPadMini5: @@ -252,7 +262,11 @@ extension Device { .iPhone15, .iPhone15Plus, .iPhone15Pro, - .iPhone15Pro_Max: + .iPhone15Pro_Max, + .iPhone16, + .iPhone16Plus, + .iPhone16Pro, + .iPhone16Pro_Max: return true default: return false