CI Status Version License Platform

Logo

版本 2

此库已从头开始完全重写。 此版本仍然提供 Deviice 结构,但它已被标记为已弃用,并将在未来版本中删除。 现在,所有的魔法都通过 Device 类完成。

用法

代码中包含了所有类、方法和属性的文档。 为了给出一个大致的概念,下面是它的工作方式。

let device = Device.init()  // This instantiate a `Device` object based on the current device.

print(device.model.marketingName)   // This prints "iPhone 12 Pro" in case it is running on an iPhone 12 Pro

还可以获取在 Mac 上模拟的实际设备。

let device = Device.init()

print(device.model.marketingName)           // This will print "Simulator"
print(device.actualModel.marketingName)     // This will print "iPhone 12 Pro" in case you're simulating an iPhone 12 Pro

在第一个版本中,无法获取特定设备的连接类型。 这可能会在以后添加。

要求

此库适用于 iOS 12 或更高版本。

安装

Deviice 可通过 Swift Package Manager 和 CocoaPods 获取。

Swift Package Manager

您可以使用 Swift Package Manager 添加此库,使用此 URL https://github.com/andrealufino/Deviice

CocoaPods

要安装它,只需将以下行添加到您的 Podfile 中

pod "Deviice"

作者

Andrea Mario Lufino, andrealufino.com。 感谢所有贡献者。

许可证

Deviice 在 MIT 许可证下可用。 有关更多信息,请参见 LICENSE 文件。