DeviceGuru 是一个简单的库 (Swift),用于了解设备的具体类型,例如 iPhone 6 或 iPhone 6s
10.0.0 引入了重大更改,如果您使用的是较旧的 8.x.x 版本,则需要进行一些修改。请查看此 PR: #94 了解更改。使用 10.0.0,该库的速度提高了 10 倍,您还可以模拟 DeviceGuru 进行测试。
添加到 Package.swift
.Package(url: "https://github.com/InderKumarRathore/DeviceGuru", branch: "master")
复制 pod 依赖项并将其添加到您的 pod 文件。例如:
pod 'DeviceGuru'
然后在终端中运行以下命令
pod install
在您的项目的 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
上述命令将自动生成所需的代码
发送 pull request 🚀
DeviceGuru 在 MIT 许可证下可用。 有关更多信息,请参见 LICENSE 文件。