Mapping device IDs to Apple device models.
An extension of the UIDevice class that returns the Apple device model name based on the internal device identifier (e.g., iPhone10,4
-> iPhone 8
or iPad16,4
-> iPad Pro 5 (11-inch, M4)
).
You can simply insert the extension text from the UIDevice+modelName.swift
file into your project, or use the Swift Package Manager to add the dependency to your project.
dependencies: [
.package(url: "https://github.com/svkrasavin/KSAppleDeviceNames.git", .upToNextMajor(from: "1.0.0"))
]
import KSAppleDeviceNames
...
let modelName = UIDevice.modelName
Based on data from:
Contributions are always welcome!