Skip to main content

iOS Integration Guide

This guide walks through integrating the Azeoo SDK into your iOS app using the initialize → connect flow and Pigeon API.

Overview

  1. Initialize – Start the Flutter engine and call the Pigeon API initialize(apiKey:config:...) (no user).
  2. Connect – Call api.connect(userId:token:completion:) when you have a user and token.
  3. Use modules – Use api.nutritionShowDiary, api.trainingShowWorkouts, or embed module view controllers from the SDK.

Basic Integration

Step 1: Initialize engine and SDK

In your AppDelegate (or SceneDelegate):

import AzeooSDK

AzeooCore.shared.initialize(enableMultipleInstances: false)
guard let engine = AzeooCore.shared.getFlutterEngine() else { return }
let api = AzeooClientApiFromEngine(engine)

let configMessage = PigeonConfigBridge.build(from: yourConfig) // Use PigeonConfigBridge to build config/theme/safeArea messages
api.initialize(apiKey: "your-api-key", config: configMessage, theme: nil, deepLinks: nil, safeArea: nil) { result in
if case .failure(let error) = result { print("Init failed: \(error)"); return }
// SDK initialized; call connect when user is available
}

Step 2: Connect a user

When the user is logged in:

api.connect(userId: "user123", token: "auth-token") { result in
switch result {
case .success: print("Connected")
case .failure(let error): print("Connect failed: \(error)")
}
}

Step 3: Use SDK UI

Use Pigeon module methods or embed view controllers from the SDK (see UI components):

api.nutritionShowDiary(dateTimestamp: nil) { _ in }
api.trainingShowWorkouts() { _ in }

Complete example

import UIKit
import AzeooSDK

class ViewController: UIViewController {
private var api: AzeooClientApi?

override func viewDidLoad() {
super.viewDidLoad()
AzeooCore.shared.initialize(enableMultipleInstances: false)
guard let engine = AzeooCore.shared.getFlutterEngine() else { return }
api = AzeooClientApiFromEngine(engine)
let configMessage = PigeonConfigBridge.build(from: yourConfig)
api?.initialize(apiKey: "your-api-key", config: configMessage, theme: nil, deepLinks: nil, safeArea: nil) { [weak self] result in
guard let self = self, case .success = result else { return }
self.api?.connect(userId: "user123", token: "auth-token") { _ in }
}
}

@IBAction func showNutrition(_ sender: UIButton) {
api?.nutritionShowDiary(dateTimestamp: nil) { _ in }
}

@IBAction func showTraining(_ sender: UIButton) {
api?.trainingShowWorkouts() { _ in }
}
}

Error handling

Handle init and connect errors in the completion handlers:

api.connect(userId: userId, token: token) { result in
switch result {
case .success: break
case .failure(let error): print("Connect failed: \(error)")
}
}

Next steps