Skip to main content
This guide covers the minimum steps to install and start using the Zixflow iOS SDK.

1. Initialize the SDK

Initialize early in application(_:didFinishLaunchingWithOptions:) on the main thread.

UIKit

import UIKit
import ZixflowDataPipelines

@main
class AppDelegate: UIResponder, UIApplicationDelegate {

    func application(
        _ application: UIApplication,
        didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
    ) -> Bool {
        let config = SDKConfigBuilder(apiKey: "YOUR_API_KEY")
            .autoTrackDeviceAttributes(true)
            .trackApplicationLifecycleEvents(true)
            .logLevel(.debug)
            .build()

        Zixflow.initialize(withConfig: config)
        return true
    }
}

SwiftUI

Create an AppDelegate and attach it with @UIApplicationDelegateAdaptor:
import UIKit
import ZixflowDataPipelines

class AppDelegate: NSObject, UIApplicationDelegate {
    func application(
        _ application: UIApplication,
        didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
    ) -> Bool {
        let config = SDKConfigBuilder(apiKey: "YOUR_API_KEY")
            .autoTrackDeviceAttributes(true)
            .trackApplicationLifecycleEvents(true)
            .logLevel(.debug)
            .build()

        Zixflow.initialize(withConfig: config)
        return true
    }
}
import SwiftUI

@main
struct YourApp: App {
    @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate

    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}
Replace YOUR_API_KEY with your API key from the Zixflow dashboard.

2. Identify and track

Zixflow.shared.identify(
    userId: "user@example.com",
    traits: [
        "email": "user@example.com",
        "first_name": "John"
    ]
)

Zixflow.shared.track(name: "checkout_started")
See Core Features for screens, attributes, logout, and more.

3. Add push notifications (optional)

After core init, initialize APNs push:
import ZixflowMessagingPushAPN

MessagingPushAPN.initialize(
    withConfig: MessagingPushConfigBuilder()
        .autoFetchDeviceToken(true)
        .autoTrackPushEvents(true)
        .showPushAppInForeground(true)
        .build()
)
For the full push setup (capabilities, NSE, FCM), see Push Notifications.

4. Add in-app messaging (optional)

import ZixflowMessagingInApp

MessagingInApp.initialize(
    withConfig: MessagingInAppConfigBuilder().build()
)
See In-App Messaging for event listeners, inline views, and inbox.