Your app, Powered by EXI Exercise Intelligence

Our personalised physical activity prescription, your app.

Get up and running with SDKs, API keys and integration tools.

EXI® iOS SDK Setup Guide

Add EXI® to your applications

Learn how to create an EXI® powered iOS application and integrate the EXI® SDK into your products and platforms.

1. Add the EXI® SDK as a dependency

  • Create a new iOS application, choosing your own specifications

Installation using CocoaPods

You will need version 1.12.1+ of Cocoapods on your machine. Instructions for installing can be found in the CocoaPods installation guide here.

Once installed you can install the SDK follows:

  • Create a Podfile, and add your dependencies:
  • Create a new project in Xcode as you would normally.
  • Open a terminal window, and $ cd into your project directory.
  • Create a Podfile. This can be done by running $ pod init .
  • Open your Podfile. The first line should specify the platform and version supported.
  • Add SDK package to your newly created podfile
pod 'EXISDK', :git => 'git@github.com:exiteam/exi-ios-framework.git', :branch => 'develop'
  • Install pod by running the following command in the project directory
$ pod install

On success

Please close any current Xcode sessions and use `YourAppName.xcworkspace` for this project from now on.
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.

Please note: Currently the pod is not published to the CocoapPods master repository but is available via an EXI private repo. Contact your line manager if authentication details have not been provided.

Your PodFile should look similar to this:

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'TestEXIiOSSDK' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for TestEXIiOSSDK
    pod 'EXISDK', :git => 'git@github.com:exiteam/exi-ios-framework.git', :branch => 'develop'

  target 'TestEXIiOSSDKTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'TestEXIiOSSDKUITests' do
    # Pods for testing
  end

end

Installation using Swift Package Manager

  1. Launch your Xcode project file
  2. Click on Swift Packages and click on the plus to add a package
  3. Enter the following repository url ‘https://github.com/exiteam/exi-ios-sdk – Connect your Github account ‘ and click next
  4. Leave the default settings to get the most recent release and click next to finish importing

2. Project Setup

Initialise the SDK

Main SDK setup method:

public func setup(configuration: EXIConfiguration)

SDK setup example:

import EXISDK
let configuration = EXIConfiguration(apiKey: "YOUR_DEVELOPER_API_KEY", jwsToken: "YOUR_JWT_TOKEN")
EXISDK.setup(configuration: configuration)
init(
    apiKey: String,
    jwsToken: String? = nil,
    logggingEnabled: Bool = true,
    mockEnabled: Bool = false
) 

3. Add Your Credentials To IDE

Paste the newly generated API key into the AppConfig-debug file to variable EXI_API_KEY

4. Start your development journey with EXI®

let configuration = EXIConfiguration(apiKey: "YOUR_DEVELOPER_API_KEY", jwsToken: "YOUR_JWT_TOKEN")
        EXISDK.setup(configuration: configuration)
            EXISDK.getPrescription { result in
                switch result {
                case .success:
                print("All Good")
                case .failure(let error):
                print(error)
                }
            }

Sample request for fetching prescriptions

func getPrescriptions() {
        Loader.shared.showLoader()
        Task { [weak self] in
            let result = await EXISDK.getPrescription()
            Loader.shared.hideLoader()
            guard let self else { return }

            guard case .success(let data) = result, let weeksData = data.weeks, !weeksData.isEmpty else {
                self.delegate?.onNoPrescription()
                return
            }

            self.weeks = weeksData.compactMap(\.week).sorted(by: <)

            guard !self.weeks.isEmpty else {
                self.delegate?.onNoPrescription()
                return
            }

            func getOnlyDatePart(_ stringDate: String?) -> String? {
                stringDate?.components(separatedBy: "T").first
            }

            func convertToDate(_ stringDate: String) -> Date? {
                Utility.stringToDate(string: stringDate, format: "yyyy-MM-dd")
            }

            if let date = getOnlyDatePart(data.weekStartDay), let unwrappedDate = convertToDate(date) {
                self.startDate = unwrappedDate
            }
            else if let date = getOnlyDatePart(data.startedAt?.dateTime), let unwrappedDate = convertToDate(date) {
                self.startDate = unwrappedDate
            }
            else {
                self.delegate?.onNoPrescription()
                return
            }

            if let currentWeekNo = data.currentWeek {
                self.currentWeek = currentWeekNo
            }
            else { // calculating current week on own if not received in response
                let weeksCompleted = Date().weeks(from: self.startDate)
                self.currentWeek = weeksCompleted + 1 // weeks function returns how many weeks completed hence need to add 1 for current week no
            }

            self.prescriptionWeeks = weeksData
            await MainActor.run {
                self.delegate?.onReturnWeeks()
            }
        }
    }

Result

RESPONSE: 200 OK
METHOD: HttpMethod(value=GET)
FROM: https://api.integration.exi.life/sdk/v1/prescriptions/weeks-stream
COMMON HEADERS
...
...
...
BODY Content-Type: application/json; charset=utf-8
BODY START
{"userId":"593e1d4f-0bb3-45b2-87e9-d12ca6623409","streamId":"fibro_2_v2","includeHighIntensity":false,"startedAt":{"dateTime":"2023-09-28T10:55:47.053Z","timezone":"Europe/London"},"weekStartDay":"2023-09-25T00:00:00+01:00","currentWeek":5,"weeks":[{"week":1,"lowMinutes":10,"setsOfLow":3,"steps":1000,"setsOfSteps":3},{"week":2,"lowMinutes":10,"setsOfLow":4,"steps":1000,"setsOfSteps":4},{"week":3,"lowMinutes":10,"setsOfLow":5,"steps":1000,"setsOfSteps":5},{"week":4,"lowMinutes":10,"setsOfLow":5,"steps":1000,"setsOfSteps":5},{"week":5,"lowMinutes":15,"setsOfLow":5,"steps":1500,"setsOfSteps":5},{"week":6,"lowMinutes":20,"setsOfLow":5,"steps":2000,"setsOfSteps":5},{"week":7,"medMinutes":15,"setsOfMed":5,"steps":1500,"setsOfSteps":5},{"week":8,"medMinutes":15,"setsOfMed":5,"steps":1500,"setsOfSteps":5},{"week":9,"medMinutes":20,"setsOfMed":5,"steps":2000,"setsOfSteps":5},{"week":10,"medMinutes":20,"setsOfMed":5,"steps":2000,"setsOfSteps":5},{"week":11,"medMinutes":25,"setsOfMed":5,"steps":2500,"setsOfSteps":5},{"week":12,"medMinutes":30,"setsOfMed":5,"steps":3000,"setsOfSteps":5}],"week":[{"week":1,"lowMinutes":10,"setsOfLow":3,"steps":1000,"setsOfSteps":3},{"week":2,"lowMinutes":10,"setsOfLow":4,"steps":1000,"setsOfSteps":4},{"week":3,"lowMinutes":10,"setsOfLow":5,"steps":1000,"setsOfSteps":5},{"week":4,"lowMinutes":10,"setsOfLow":5,"steps":1000,"setsOfSteps":5},{"week":5,"lowMinutes":15,"setsOfLow":5,"steps":1500,"setsOfSteps":5},{"week":6,"lowMinutes":20,"setsOfLow":5,"steps":2000,"setsOfSteps":5},{"week":7,"medMinutes":15,"setsOfMed":5,"steps":1500,"setsOfSteps":5},{"week":8,"medMinutes":15,"setsOfMed":5,"steps":1500,"setsOfSteps":5},{"week":9,"medMinutes":20,"setsOfMed":5,"steps":2000,"setsOfSteps":5},{"week":10,"medMinutes":20,"setsOfMed":5,"steps":2000,"setsOfSteps":5},{"week":11,"medMinutes":25,"setsOfMed":5,"steps":2500,"setsOfSteps":5},{"week":12,"medMinutes":30,"setsOfMed":5,"steps":3000,"setsOfSteps":5}]}
BODY END

You are now ready to build your customer health journeys!

Please consult our iOS developer code docs and our UML Diagram repository to discover what is possible with EXI® SDK.