Swift wrapper around CoreBluetooth. Library allows you to connect to BLE devices, read and write data to them
To run the example project, clone the repo, and run pod install
from the Example directory first.
private let ble: BLE = BLE()
// Enable debug mode
self.ble.debugMode = true
// Set delegate
self.ble.delegate = self
// Scan for all devices
self.ble.startScanning(10) // Scan for 10 seconds
// Scan for some UUIDs only
self.ble.startScanning(10, serviceUUIDs: ["713D0000-503E-4C75-BA94-3148F18D941E"]) // Scan for 10 seconds
// Write three values to one service
var buffer: [UInt8] = [1, 0, 100]
let data: NSData = NSData(bytes: buffer, length: 3)
try! self.ble?.write(data, characteristicsUUID: "713D0003-503E-4C75-BA94-3148F18D941E")
Needs to run on a device, not simulator
BLE is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "BLE"
Ondrej Rafaj, rafaj@mangoweb.cz
BLE is available under the MIT license. See the LICENSE file for more info.