On iOS, the Aidlab SDK is provided as a fat framework (Aidlab.framework). Framework contains all the necessary code to use the SDK.

Aidlab SDK for iOS was build with Swift 5, using Xcode 11.5 and is created on the top of Apple's Core Bluetooth technology.


To use the framework in an Xcode project, just drag and drop the AidlabSDK.framework file in the Project Navigator. Make sure that the file is also present in your project's directory.

If you're getting a No such module AidlabSDK error while trying to import the framework, go into your project's Build Settings and check the following points:

Xcode Build Settings

  1. Runpath Search Paths under the Linking tab should contain two values: @executable_path/Frameworks and $(inherited).

  2. Find Framework Search Paths under the Search Paths tab and add $(inherited) to both Debug and Release, if it's not already there.


To start your connection with Aidlab, you need to create an AidlabSDK object:

aidlabSDK = AidlabSDK(delegate: self, aidlabDelegate: self)

The scan function enables scanning for nearby Aidlabs. If one is found, the didDiscover function is called. An exemplary implementation of the function:

func didDiscover(_ aidlab: CBPeripheral) {

    let signals: [Signal] = [.ecg, .activity, .steps]

    aidlabSDK?.connect(signals, reconnect: true, peripheral: aidlab)

The connect function expects three parameters:

  • signals - an array of signals you would like to listen to. List of the available signals.
  • reconnect - a Bool variable which determines if you would like to automatically try to connect to Aidlab after disconnecting.
  • peripheral - the name of the peripheral you'd like to connect to (in this case aidlab).

The stopScan function stops searching for new Aidlabs - don't use it here if you'd like to connect to multiple Aidlabs at once.

For each event, the first parameter is an IAidlab object:

public protocol IAidlab: class {

    var address: UUID? { get }
    var firmwareRevision: String? { get }
    var hardwareRevision: String? { get }
    var serialNumber: String? { get }
    /* Aidlab's synchronization delegate */
    var aidlabSynchronizationDelegate: AidlabSynchronizationDelegate? {get set}
    /* Communicate with and control Aidlab. More about that below. */
    func send(_ command: String)
    /* Disconnect from Aidlab. */
    func disconnect()
    /* Set the ECG Filtraton Method to normal or aggresive. */
    func setECGFiltrationMethod(_ ecgFiltrationMethod: ECGFiltrationMethod)
    /* Read the Received Signal Strength Indicator
        (a value between 0 and -120 measured in decibels). */
    func readRSSI()
    func startSynchronization()
    func stopSynchronization()

Saving data

While developing an app in Swift, you can take control over synchronization. After acquiring data and connecting Aidlab to your device, Aidlab will start sending unsynchronized data immediately. To change that, you can use the following functions on your IAidlab object:

func startSynchronization()
func stopSynchronization()


If you'd like to distribute your app on the App Store, you need to do the following.

Under the Build phases tab in your project's settings, add a new Run Script phase, as in the screenshot below.

Xcode view

Then, paste the following script into the designated area:

# Author: Daniel Kennett (


# This script loops through the frameworks embedded in the application and
# removes unused architectures.
find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)


for ARCH in $ARCHS

echo "Merging extracted architectures: ${ARCHS}"
lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}"

echo "Replacing original executable with thinned version"


The script will look through your built application’s Frameworks folder and make sure only the architectures you’re building for are present in each Framework.

results matching ""

    No results matching ""