Appearance
Adding the SDK
1.1 Swift Package Manager (binary distribution)
The SDK ships as two .xcframeworks behind a Swift Package at the root of the binary repo.
In Xcode: File → Add Package Dependencies…, enter the repository URL, choose Exact Version, and add the SensorBioSDK library to your app target. From another package:
swift
dependencies: [
.package(
url: "https://github.com/GetSensr-io/mobile_sensorbio_sdk_ios_binary.git",
exact: "4.2.0"
)
],
targets: [
.target(
name: "MyApp",
dependencies: [
.product(name: "SensorBioSDK", package: "mobile_sensorbio_sdk_ios_binary")
]
)
]Then import SensorBioSDK. There are no build settings to configure and no post_install step.
The SDK declares no third-party packages, and you do not need to declare any for it. Everything it links — its gRPC stack, SwiftProtobuf, the keychain libraries, the job-queue runtime, the MQTT client, and the BLE pairing/sync engine — is compiled inside SensorBioSDK.xcframework and is invisible to your dependency graph, so none of it can collide with a library you use yourself. If a symbol looks missing, do not add a package to satisfy it; contact support@sensorbio.com.
PSP.xcframework (the Philips sleep library) ships alongside and is linked transitively — it has no user-callable surface, and neither does the BLE engine. Customers only import SensorBioSDK.
Full integration walkthrough, including the launch configuration and the registration flow: see README.md.
1.2 Platform requirements
- iOS 18+ — required minimum deployment target
- Xcode 16.3+ (Swift 6.1 toolchain)
- Bluetooth + Background Modes capabilities — required so the SDK can stay connected to the wearable and finish syncs while the app is backgrounded
1.3 Importing
swift
import SensorBioSDKThe library exports a single top-level accessor for the SDK singleton — use it instead of SB_SDK.shared (both work; the short alias is the preferred idiom):
swift
public let sensorBio = SB_SDK.sharedModule vs class. The framework module is
SensorBioSDK; the singleton class inside it isSB_SDK. TheSB_prefix on the class is part of the SDK's binary-distribution naming convention.
1.4 Required Info.plist keys & background capabilities
The SDK talks to Sensor Bio wearables over Bluetooth LE and needs to stay connected while the host app is backgrounded so syncs can complete. Packet uploads now drive off BLE-sync completion — there is no separate background-fetch or BGTaskScheduler path — so the consuming app only has to declare the BLE-related keys below.
Bluetooth
Add the user-facing usage strings to Info.plist. They are surfaced in the system permission prompt the first time the SDK starts a scan; ship a copy that names your product:
| Key | Required | Purpose |
|---|---|---|
NSBluetoothAlwaysUsageDescription | yes | Shown when the SDK requests Bluetooth permission on iOS 13+. Required for scanning, connecting, syncing, and background BLE. |
NSBluetoothPeripheralUsageDescription | yes (legacy) | Required for App Store review on apps that still target older iOS deployment floors. Even on iOS 18+ apps it is safest to include it. |
Example:
xml
<key>NSBluetoothAlwaysUsageDescription</key>
<string>MyApp uses Bluetooth to connect to your Sensor Bio wearable and sync biometrics in the background.</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>MyApp uses Bluetooth to connect to your Sensor Bio wearable.</string>Background mode
Enable the Background Modes capability on the app target and tick Uses Bluetooth LE accessories (or add bluetooth-central directly to Info.plist under UIBackgroundModes):
| Mode | UIBackgroundModes value | Why the SDK needs it |
|---|---|---|
| Uses Bluetooth LE accessories | bluetooth-central | Keep the BLE connection alive, finish in-progress syncs, and receive sensor packets while the app is backgrounded. Uploads run as each sync completes. |
Example:
xml
<key>UIBackgroundModes</key>
<array>
<string>bluetooth-central</string>
</array>The SDK does not register
BGTaskScheduleridentifiers, so there is noBGTaskSchedulerPermittedIdentifiersrequirement and no need forfetchorprocessingmodes.
Sanity check
If either of the BLE-related entries is missing, you will see one of the following at runtime:
- No BLE prompt /
CBManager.authorization == .denied→NSBluetoothAlwaysUsageDescriptionis missing. - App suspends mid-sync →
bluetooth-centralis not inUIBackgroundModes.