Skip to content

Commit

Permalink
Adding support for iPad Pro 13 M2, M4 devices (#133)
Browse files Browse the repository at this point in the history
* Adding support for iPad Pro 13 M2, M4 devices

* Updated screenheight switch cases order

* Updated 11 inch M2, M4 screenHeight
  • Loading branch information
divyesh-makwana authored Jun 28, 2024
1 parent 9cc8be6 commit 8eef81c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Example/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ class ViewController: UIViewController {
case .screen7_9Inch: print("It's a 7.9 inch screen")
case .screen9_7Inch: print("It's a 9.7 inch screen")
case .screen10_5Inch: print("It's a 10.5 inch screen")
case .screen11Inch: print("It's an 11 inch screen")
case .screen12_9Inch: print("It's a 12.9 inch screen")
case .screen13Inch: print("It's a 13 inch screen")
default: print("Unknown size")
}

Expand Down
2 changes: 2 additions & 0 deletions Source/Size.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public enum Size: Int, Comparable {
case screen11Inch
/// iPad Pro (12.9-inch)
case screen12_9Inch
/// iPad Pro (13-inch)
case screen13Inch
#elseif os(OSX)
case screen11Inch
case screen12Inch
Expand Down
2 changes: 2 additions & 0 deletions Source/Version.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ public enum Version: String {
case iPadPro12_9Inch4
case iPadPro12_9Inch5
case iPadPro12_9Inch6
case iPadPro13InchM2
case iPadPro13InchM4

/*** iPod ***/
case iPodTouch1Gen
Expand Down
6 changes: 5 additions & 1 deletion Source/iOS/Device.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ open class Device {
case "iPad13,8", "iPad13,9", "iPad13,10", "iPad13,11": return .iPadPro12_9Inch5
case "iPad14,3", "iPad14,4": return .iPadPro11_0Inch4
case "iPad14,5", "iPad14,6": return .iPadPro12_9Inch6
case "iPad14,10", "iPad14,11": return .iPadPro13InchM2
case "iPad16,5", "iPad16,6": return .iPadPro13InchM4

/*** iPod ***/
case "iPod1,1": return .iPodTouch1Gen
Expand Down Expand Up @@ -189,10 +191,12 @@ open class Device {
return .screen10_5Inch
case 1180:
return .screen10_9Inch
case 1194:
case 1194, 1210:
return .screen11Inch
case 1366:
return .screen12_9Inch
case 1376:
return .screen13Inch
default:
return .unknownSize
}
Expand Down

0 comments on commit 8eef81c

Please sign in to comment.