Quickstart
Stream your first biosignal from a BLE wearable in under 5 minutes.
1. Install the SDK
Add the binary Swift package in Xcode:
- File > Add Package Dependencies...
- Enter:
https://github.com/anybio/biosdk-ios-binary.git - Add the
BioSDKproduct to your app target
See the full Installation guide for details.
2. Configure the SDK
import BioSDK
// Initialize with your project credentials
let config = BioSDKClient.Configuration(
environment: .auto,
organizationKey: "org_your_key",
projectKey: "proj_your_key"
)
let sdk = try await BioSDKClient.initialize(configuration: config)
3. Subscribe to Events
import Combine
var cancellables = Set<AnyCancellable>()
sdk.events
.sink { event in
switch event {
case .lifecycle(let lifecycle):
switch lifecycle {
case .discovered(let device):
print("Found: \(device.name)")
case .connected(let device):
print("Connected: \(device.name)")
case .disconnected(let device, _, _, _):
print("Disconnected: \(device.name)")
}
case .sample(let deviceId, let sample):
print("[\(deviceId)] \(sample.signalName): \(sample.data)")
case .deviceState(let device, let connection, let stream):
print("\(device.name): \(connection) / \(stream)")
case .session(let sessionEvent):
print("Session: \(sessionEvent)")
case .notification:
break
}
}
.store(in: &cancellables)
4. Scan and Connect
// Start scanning for BLE devices
sdk.startScan()
// When you find your device (e.g., from a UI list):
let device = sdk.discoveredDevices.first!
sdk.connect(device)
5. Start Streaming
Once the device reaches .ready connection state:
sdk.startStreaming(deviceId: device.id)
Biosignal samples will flow through the events publisher as .sample events.
6. Stop and Disconnect
sdk.stopStreaming(deviceId: device.id)
sdk.disconnect(device)
What's Next
- Configuration — Environment setup and SDK options
- Scanning & Connecting — Device discovery and connection lifecycle
- Session Management — Session lifecycle, conflict handling, and recovery
- BioUI Widgets — Add real-time charts to your SwiftUI views