π iOS Quick Start
Prerequisitesβ
- Xcode 15+
- API key from Client Platform
- SPM: add package from Downloads or local
sdk/ios - Monorepo: run
./scripts/ios_build.shfirst
Step 1: Add the packageβ
Swift Package Manager β dependency URL in Downloads.
Local development:
.package(path: "../../sdk/ios")
Product: AzeooSDK.
Step 2: Initializeβ
import AzeooSDK
let config = AzeooConfig(
locale: "en",
analyticsEnabled: true,
offlineEnabled: true,
connectionTimeoutSeconds: 30,
persistSession: true
)
let deepLinks = AzeooDeepLinkConfig(scheme: "https", host: "azeoo.com")
let safeArea = AzeooSafeAreaConfig(top: true, bottom: true, left: true, right: true)
AzeooSDK.initialize(
apiKey: "YOUR_API_KEY",
config: config,
theme: themeConfig,
deepLinks: deepLinks,
safeArea: safeArea
) { result in
switch result {
case .success:
break // show connect UI
case .failure(let error):
break
}
}
Step 3: Connectβ
Pass a User JWT created by your backend. See Creating the User JWT for the payload spec and backend code examples.
AzeooSDK.shared.connectUser(
token: userJwt, // JWT from YOUR backend β see link above
gender: user.gender,
height: user.height,
weight: user.weight
) { result in
// handle profile
}
Step 4: Embed UIβ
SwiftUIβ
AzeooSDK.shared.modules.nutrition.getView()
In a TabView, see example/ios_example/ContentView.swift.
UIKit (recommended for tabs)β
let nutrition = sdk.tabHost(for: .nutrition)
let training = sdk.tabHost(for: .training)
// Add as view controllers to UITabBarController
See example/ios_example_uikit/MainTabBarController.swift.
Tab coordinatorβ
let coordinator = AzeooSwiftUITabCoordinator(selection: $tab, mapping: [
.nutrition: 1,
.training: 2,
])
sdk.setModuleContainer(coordinator)
Step 5: Disconnectβ
AzeooSDK.shared.disconnect { }
Generated API docsβ
Static DocC site under /ios-docs/ on the docs website β supplement only; follow this guide for integration.
Next stepsβ
- Creating the User JWT β payload spec and backend code
- Configuration
- Multi-tab UI
- Examples