From b42843ec0e08bad7fd2d68697823c71217197e5d Mon Sep 17 00:00:00 2001 From: mlch911 Date: Sun, 22 Sep 2024 20:31:45 +0800 Subject: [PATCH] Add New iPhones (#138) * Update .gitignore * Add New iPhones --- .gitignore | 1 + Source/Size.swift | 8 ++++++-- Source/Version.swift | 4 ++++ Source/iOS/Device.swift | 18 ++++++++++++++++-- 4 files changed, 27 insertions(+), 4 deletions(-) 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 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 79063e5..958c330 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 1bf0124..68ed95c 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 @@ -118,7 +122,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 } } @@ -167,6 +173,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: @@ -178,6 +186,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: @@ -254,7 +264,11 @@ extension Device { .iPhone15, .iPhone15Plus, .iPhone15Pro, - .iPhone15Pro_Max: + .iPhone15Pro_Max, + .iPhone16, + .iPhone16Plus, + .iPhone16Pro, + .iPhone16Pro_Max: return true default: return false