Native iOS apps use the BluetoothSDK Swift package.

Requirements

  • iOS deployment target 15.1 or newer.
  • Xcode 15 or newer.
  • Swift Package Manager.
  • A physical iPhone for Bluetooth, camera, microphone, direct phone photo, and direct phone WebRTC testing.

Install

The Swift package is not available yet, because SwiftPM publishing is paused. Use the React Native package, which installs from npm.
The SwiftPM install steps below need the package to be published. In Xcode, choose File > Add Package Dependencies, enter the package URL, select version 0.4.5-dev.1416, and add the BluetoothSDK product to your app target. For Package.swift consumers:
Then add the product to your target:
The SwiftPM package builds the core Bluetooth SDK only. It does not build optional local STT, TTS, tar.bz2 extraction, or Mentra Display code paths.

Permissions

Add usage descriptions to Info.plist:

Background Operation

If your iOS app needs to keep the glasses BLE link alive while the phone is locked or the app is backgrounded, enable Core Bluetooth background mode:
If your app also keeps microphone capture or an audio session active in the background, add audio as well:
Configure your AVAudioSession before starting continuous microphone or playback work. Start continuous microphone capture while the app is foregrounded; iOS background mode lets an active session continue, but the SDK does not start the phone microphone from the background. For example:
bluetooth-central allows iOS to continue BLE central activity in the background, subject to iOS scheduling and power-management limits. audio is required only for apps that intentionally keep recording or audio playback active after backgrounding.

Relaunch After iOS Terminates The App

With bluetooth-central in UIBackgroundModes, the SDK creates each glasses and controller Core Bluetooth central manager with a restore identifier. When iOS terminates the app for memory pressure, a crash, or the watchdog, those connections stay up in the system. The next peripheral event relaunches the app in the background. A native app wires two calls. From application(_:didFinishLaunchingWithOptions:), pass the restored identifiers so the SDK recreates its central managers before the first scan:
Then, once your BluetoothSDK instance exists, call sdk.consumeBluetoothRestoreLaunch(). It returns true once per launch when iOS relaunched the app for a preserved connection. Call connectDefault() then, without waiting for a screen to ask. A force quit from the app switcher drops the preserved state.

Basic Flow

Local SDK Override

This needs access to the Glassly source repository. Use it when testing native Swift SDK source changes locally:
Add that folder as a local Swift package in Xcode. Keep local paths in your workspace settings or CI environment, not in committed project settings.