DeviceGuru
DeviceGuru 是一个简单的库(Swift),用于确定设备的精确类型,例如 iPhone 6 或 iPhone 6s。
- 易于使用
- 轻量级
10.0.0 发布
10.0.0 引入了破坏性更改,因此如果您正在使用较旧版本 8.x.x,则需要进行一些更改。请检查此 PR:[#94](https://github.com/InderKumarRathore/DeviceGuru/pull/94) 中的更改。随着 10.0.0,该库的速度提高 10 倍,并且您还可以为测试伪造 DeviceGuru。
安装
使用 Swift 包管理器
添加到 Package.swift
.Package(url: "https://github.com/InderKumarRathore/DeviceGuru", branch: "master")
使用 CocoaPods
复制 pod 依赖并将其添加到您的 pod 文件中。例如:
pod 'DeviceGuru'
然后在终端中运行以下命令
pod install
使用 Carthage
在项目的 Cartfile
中指定 DeviceGuru
github "InderKumarRathore/DeviceGuru"
手动
拖拽此文件夹
Sources
到您的项目文件中
使用方法
如果您从 CocoaPods 安装,则需要导入模块。如果您使用拖拽方式,则不需要导入
import DeviceGuru
在您的代码中
let deviceGuru = DeviceGuruImplementation()
let deviceName = deviceGuru.hardware
let deviceCode = deviceGuru.hardwareString
let platform = deviceGuru.platform
print("\(deviceName) - \(deviceCode) - \(platform)")
查看 示例项目
!
开发
想要贡献?太好了!只需更新 GeneratorDevice.plist
然后
cd Generator
./main.swift
上述命令将自动生成所需的代码
发送拉取请求
许可协议
DeviceGuru 在 MIT 许可协议下可用。有关更多信息,请参阅 LICENSE 文件。