Skip to content

Latest commit

 

History

History
45 lines (32 loc) · 1.47 KB

README.md

File metadata and controls

45 lines (32 loc) · 1.47 KB

GitHub, Ledger Devs Discord, Developer Portal

BleTransport (beta)

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.

Usage

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)")
}

Installation

Swift Package Manager

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")
]