Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add New iPhones #138

Merged
merged 2 commits into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -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
}
}

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