SwiftyDevice 1.0.2

SwiftyDevice 1.0.2

Damien Legrand维护。



SwiftyDevice

Version License Platform

示例

要运行示例项目,克隆仓库,然后在示例目录中首先运行 pod install

要求

在以下环境中测试

  • Xcode 9
  • Swift 4.1

安装

SwiftyDevice 通过CocoaPods 提供。安装它,只需将以下行添加到您的 Podfile 中。

pod 'SwiftyDevice'

使用方法

要使用 SwifyDevice,请导入它

import SwiftyDevice

并在代码中

/// Get information about the current device

let device = Device.currentDevice

print("Device family name : \(device.family.rawValue)") // Device family name : iPad Pro 10.5" (Wi-Fi)
print("Device release date : \(device.releaseDate)") // Device release date : 06/05/2017

/// Or get information about another device with the codename

let otherDevice = Device.device(with: "iPhone9,4") // otherDevice.family == DeviceFamily.iPhone7Plus

查看支持设备列表:支持设备

开发

文件 Devices.plistDeviceFamily.swiftDevices.md 由项目中的另一个目标HardwareParser自动生成。要向项目中添加新设备,只需在mac上运行 HardwareParser 方案,这两个文件将更新为来自www.everymac.com的数据。

作者

Damien Legrand

许可证

SwiftyDevice 在 MIT 许可下可用。更多详情请查看 LICENSE 文件。