Skip to content

Commit

Permalink
Add New iPhones (#138)
Browse files Browse the repository at this point in the history
* Update .gitignore

* Add New iPhones
  • Loading branch information
mlch911 authored Sep 22, 2024
1 parent a22c0ab commit b42843e
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ DerivedData
# Carthage/Checkouts

Carthage/Build
.DS_Store
8 changes: 6 additions & 2 deletions Source/Size.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions Source/Version.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 16 additions & 2 deletions Source/iOS/Device.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
}

Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -254,7 +264,11 @@ extension Device {
.iPhone15,
.iPhone15Plus,
.iPhone15Pro,
.iPhone15Pro_Max:
.iPhone15Pro_Max,
.iPhone16,
.iPhone16Plus,
.iPhone16Pro,
.iPhone16Pro_Max:
return true
default:
return false
Expand Down

0 comments on commit b42843e

Please sign in to comment.