From 8eef81c09e5736a4f35a11df9df835d51c5c37d5 Mon Sep 17 00:00:00 2001 From: divyesh-makwana Date: Fri, 28 Jun 2024 11:52:28 -0700 Subject: [PATCH] Adding support for iPad Pro 13 M2, M4 devices (#133) * Adding support for iPad Pro 13 M2, M4 devices * Updated screenheight switch cases order * Updated 11 inch M2, M4 screenHeight --- Example/ViewController.swift | 2 ++ Source/Size.swift | 2 ++ Source/Version.swift | 2 ++ Source/iOS/Device.swift | 6 +++++- 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Example/ViewController.swift b/Example/ViewController.swift index 3c1ec86..c0ce602 100644 --- a/Example/ViewController.swift +++ b/Example/ViewController.swift @@ -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") } diff --git a/Source/Size.swift b/Source/Size.swift index 3f486b3..2bb04d7 100644 --- a/Source/Size.swift +++ b/Source/Size.swift @@ -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 diff --git a/Source/Version.swift b/Source/Version.swift index 538002f..e68f393 100644 --- a/Source/Version.swift +++ b/Source/Version.swift @@ -87,6 +87,8 @@ public enum Version: String { case iPadPro12_9Inch4 case iPadPro12_9Inch5 case iPadPro12_9Inch6 + case iPadPro13InchM2 + case iPadPro13InchM4 /*** iPod ***/ case iPodTouch1Gen diff --git a/Source/iOS/Device.swift b/Source/iOS/Device.swift index 4810403..267a3d6 100644 --- a/Source/iOS/Device.swift +++ b/Source/iOS/Device.swift @@ -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 @@ -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 }