This library facilitates developers in easily determining the device model, which is particularly valuable for gathering statistics on user device distribution. It offers various other benefits as well.
To run the Example project, clone the repo, and run pod install
from the Example directory first, then open the Xcode workspace.
To run the SPMExample project, clone the repo, and open the Xcode project.
iModels is available through SPM. Use below URL to add it as a dependency
dependencies: [
.package(url: "https://github.com/AnbalaganD/iModels", .upToNextMajor(from: "0.1.5"))
]
iModels is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'iModels'
import iModels
Device.modelName // The most commonly used
Device.identifier // Apple's identifiers
// for other device identifiers
print("\(Device.modelName(for: "iPhone8,2") ?? "unknown")")
// output: iPhone 6s Plus
The Device.modelName
variable will now append the name "Simulator" to the model name when running within the simulator. If you want to avoid this behavior, you can use Device.modelName(for: Device.identifier)
.
iModels is available under the MIT license. See the LICENSE file for more info.