USBDeviceSwift
USBDeviceSwift - 是一个基于纯 Swift 编写的 IOKit.usb
、IOKit.hid
和 IOKit.serial
的封装,方便您使用 USB 设备。
![]() |
![]() |
---|---|
![]() |
在 Swift 上处理 IOKit.usb
、IOKit.hid
和 IOKit.serial
是一件痛苦的事情。大量的未转换的 C 代码和指针会使您的日子更难熬。此库提供了基本的连接/断开事件、发送和接收请求的转换函数和示例。
入门指南
系统要求
- Mac OS X 10.10
- Xcode 8+
- Swift 4
安装
CocoaPods
CocoaPods 是一个 Cocoa 项目的依赖管理器。
在项目的 Podfile
中包含 USBDeviceSwift
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'testusb' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for testusb
pod 'USBDeviceSwift'
end
然后运行以下命令
$ pod install
Swift 包管理器
import PackageDescription
let package = Package(
name: "Example project",
dependencies: [
.Package(url: "https://github.com/Arti3DPlayer/USBDeviceSwift.git", majorVersion: 1),
]
)
示例
所有示例可以在 Wiki 页面上找到 这里
许可协议
本项目的许可是 MIT 许可证 - 有关详细信息,请参阅 LICENSE.md 文件。
变更记录
可以在 CHANGELOG.md 文件中找到。