https://github.com/anbalagand/imodels
This library provide device(iPhone) model name with human readable way
https://github.com/anbalagand/imodels
cocoapods device-model devicename ios ipad iphone modelname spm swift swiftpackagemanager swiftui watchos
Last synced: 4 months ago
JSON representation
This library provide device(iPhone) model name with human readable way
- Host: GitHub
- URL: https://github.com/anbalagand/imodels
- Owner: AnbalaganD
- License: mit
- Created: 2023-02-18T18:14:05.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-08-10T14:30:05.000Z (almost 2 years ago)
- Last Synced: 2024-10-10T22:42:14.710Z (over 1 year ago)
- Topics: cocoapods, device-model, devicename, ios, ipad, iphone, modelname, spm, swift, swiftpackagemanager, swiftui, watchos
- Language: Swift
- Homepage:
- Size: 219 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# iModels
[](https://cocoapods.org/pods/iModels)
[](LICENSE)
[](https://swiftpackageindex.com/AnbalaganD/iModels)
[](https://swiftpackageindex.com/AnbalaganD/iModels)
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.
## Examples
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 **iModelsExample** project, clone the repo, and open the Xcode project.
## Installation
### Swift Package manager (SPM)
iModels is available through [SPM](https://github.com/AnbalaganD/iModels). Use below URL to add it as a dependency
```swift
dependencies: [
.package(url: "https://github.com/AnbalaganD/iModels", .upToNextMajor(from: "0.1.8"))
]
```
### CocoaPods
iModels is available through [CocoaPods](https://cocoapods.org/pods/iModels). To install
it, simply add the following line to your Podfile:
```ruby
pod 'iModels'
```
> **Note:** CocoaPods updates will not be provided for upcoming releases, as CocoaPods is no longer actively supported and has entered maintenance mode.
## Usage
```swift
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
```
#### Simulator Note
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)`.
## Authors
* [Anbalagan D](mailto:anbu94p@gmail.com)
* [Bill Shirley](mailto:bshirley@shirl.com)
## License
iModels is available under the MIT license. See the LICENSE file for more info.