GitHub, Ledger Devs Discord, Developer Portal
Allows for communication with Ledger Hardware Wallets via BLE (Bluetooth Low Energy) on iOS (>=13.0) and macOS (>=12.0). Please note that this is a beta release and still under active development.
The demo application is the best way to see BleTransport
in action. Simply open the BleTransport.xcodeproj
and run the BleTransportDemo
or BleTransportDemoMac
scheme.
Basic example:
import BleTransport
BleTransport.shared.scan(duration: 30.0) { discoveries in
guard let id = discoveries.first?.peripheral else {
return
}
BleTransport.shared.connect(toPeripheralID: id, disconnectedCallback: nil) { peripheral in
print("Connected to device: \(peripheral.name)")
} failure: { error in
print("Error while connecting: \(error)")
}
} stopped: { error in
print("Error while scanning: \(error)")
}
To integrate using Apple's Swift Package Manager, add the following as a dependency to your Package.swift
:
dependencies: [
.package(url: "https://github.com/LedgerHQ/hw-transport-ios-ble.git", from: "1.0.0")
]