SwiftUSB is a Swift 6.1 wrapper around libusb 1.0, shaped as a pyusb-like package for Swift programs. It provides a small, Swift-native API for listing USB devices, reading owned configuration, interface, alternate-setting, and endpoint descriptors, opening device handles, claiming interfaces, and issuing control or interrupt transfers.
- Swift 6.1 or newer
- libusb 1.0
- macOS 10.15 or newer for the supported package target
Install libusb with Homebrew:
brew install libusbOn Debian or Ubuntu:
sudo apt install libusb-1.0-0-devswift testSwiftUSB ships DocC documentation in Sources/SwiftUSB/SwiftUSB.docc. CI also
builds a public symbol graph so publish candidates include generated API
documentation evidence.
Hardware tests live in Tests/HardwareTests. They expect a connected USB
device that matches the test probe requirements.
Use a local checkout during development:
.package(path: "../SwiftUSB")Use the published repository after tagging a release:
.package(url: "https://github.com/xsyetopz/SwiftUSB.git", from: "0.1.2")Add the library product to the target that talks to USB devices:
.product(name: "SwiftUSB", package: "SwiftUSB")See docs/PUBLISHING.md for the release checklist. Swift Package Manager
consumes packages from Git tags. Prepare and merge the versioned release state,
then run the Release workflow from main. Actions runs the full checks
before it creates the semantic version tag and GitHub Release.