|
9 | 9 | import SwiftUI |
10 | 10 | import os |
11 | 11 |
|
| 12 | +func deviceHasEnoughRam() -> Bool { |
| 13 | + let requiredRAM: UInt64 = 6 * 1024 * 1024 * 1024 |
| 14 | + let totalRAM = ProcessInfo.processInfo.physicalMemory |
| 15 | + print("Total RAM (GB)", totalRAM / (1024 * 1024 * 1024)) |
| 16 | + return totalRAM >= requiredRAM |
| 17 | +} |
| 18 | + |
12 | 19 | // Device support check function |
13 | 20 | func isDeviceSupported() -> Bool { |
14 | 21 | #if targetEnvironment(simulator) |
15 | 22 | return true |
16 | 23 | #else |
17 | | - let deviceModel = UIDevice.current.modelName |
18 | | - |
19 | | - // Model identifiers for devices with 8GB of RAM or more (iPhones and iPads) |
20 | | - let supportedModels = [ |
21 | | - // iPhone models with 8GB RAM |
22 | | - "iPhone16,1", "iPhone16,2", // iPhone 15 Pro and Pro Max |
23 | | - "iPhone17,1", "iPhone17,2", "iPhone17,3", "iPhone17,4", // all iPhone 16 models |
24 | | - |
25 | | - // iPad models with 8GB or more RAM |
26 | | - "iPad14,3", "iPad14,4", // iPad Pro 11" 4th Gen |
27 | | - "iPad14,5", "iPad14,6", // iPad Pro 12.9" 6th Gen |
28 | | - "iPad16,3", "iPad16,4", // iPad Pro 11" 5th Gen |
29 | | - "iPad16,5", "iPad16,6", // iPad Pro 12.9" 7th Gen |
30 | | - "iPad13,16", "iPad13,17", // iPad Air 5th Gen |
31 | | - "iPad14,8", "iPad14,9", // iPad Air 6th Gen |
32 | | - "iPad15,1", "iPad15,2", // Hypothetical future iPad models with 8GB RAM |
33 | | - ] |
34 | | - |
35 | | - return supportedModels.contains(deviceModel) |
| 24 | + return deviceHasEnoughRam() |
36 | 25 | #endif |
37 | 26 | } |
38 | 27 |
|
|
0 commit comments