Skip to content

Commit

Permalink
Extended DeviceInfo with 2021 iPhone/iPad models
Browse files Browse the repository at this point in the history
  • Loading branch information
Alkenso committed Apr 24, 2022
1 parent 09e491c commit f8da821
Showing 1 changed file with 35 additions and 2 deletions.
37 changes: 35 additions & 2 deletions Sources/SwiftConvenience/System & Hardware/DeviceInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,16 @@ public extension DeviceInfo {
case iPhone11
case iPhone11Pro
case iPhone11ProMax
case iPhoneSE2nd
case iPhoneSE2
case iPhone12Mini
case iPhone12
case iPhone12Pro
case iPhone12ProMax
case iPhoneSE3
case iPhone13Mini
case iPhone13
case iPhone13Pro
case iPhone13ProMax

case iPod1
case iPod2
Expand Down Expand Up @@ -149,11 +154,17 @@ public extension DeviceInfo {
case iPadPro4_11
case iPadPro4_12_9
case iPadMini5
case iPadMini6_WiFi // iPad14,1
case iPadMini6_Cellular // iPad14,2
case iPadAir3
case iPad8
case iPad9_WiFi // iPad12,1
case iPad9_Cellular // iPad12,2
case iPadAir4
case iPadPro3_11
case iPadPro5_12_9
case iPadAir5_WiFi // iPad13,16
case iPadAir5_Cellular // iPad13,17

case other(String)
}
Expand Down Expand Up @@ -211,7 +222,7 @@ public extension DeviceInfo {
case "iPhone12,5":
return .iPhone11ProMax
case "iPhone12,8":
return .iPhoneSE2nd
return .iPhoneSE2
case "iPhone13,1":
return .iPhone12Mini
case "iPhone13,2":
Expand All @@ -220,6 +231,16 @@ public extension DeviceInfo {
return .iPhone12Pro
case "iPhone13,4":
return .iPhone12ProMax
case "iPhone14,6":
return .iPhoneSE2
case "iPhone14,4":
return .iPhone13Mini
case "iPhone14,5":
return .iPhone13
case "iPhone14,2":
return .iPhone13Pro
case "iPhone14,3":
return .iPhone13ProMax

case "iPod1,1": // 1st Gen iPod
return .iPod1
Expand Down Expand Up @@ -376,6 +397,18 @@ public extension DeviceInfo {
return .iPadPro5_12_9
case "iPad13,11": // iPad Pro 12.9 inch 5th Gen
return .iPadPro5_12_9
case "iPad14,1":
return .iPadMini6_WiFi
case "iPad14,2":
return .iPadMini6_Cellular
case "iPad12,1":
return .iPad9_WiFi
case "iPad12,2":
return .iPad9_Cellular
case "iPad13,16":
return .iPadAir5_WiFi
case "iPad13,17":
return .iPadAir5_Cellular

default:
return .other(modelName)
Expand Down

0 comments on commit f8da821

Please sign in to comment.