Skip to main content

UIKit vs SwiftUI

UIKit Initialization

Use AppDelegate for UIKit apps:
import ZixflowDataPipelines

@main
class AppDelegate: UIResponder, UIApplicationDelegate {
    func application(
        _ application: UIApplication,
        didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
    ) -> Bool {
        let config = SDKConfigBuilder(apiKey: "YOUR_API_KEY").build()
        Zixflow.initialize(withConfig: config)
        return true
    }
}

SwiftUI Initialization

Use @UIApplicationDelegateAdaptor for SwiftUI apps:
@main
struct YourApp: App {
    @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate

    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}

Screen Tracking Differences

  • UIKit: Enable automatic screen tracking with .autoTrackUIKitScreenViews()
  • SwiftUI: Track screens manually:
.onAppear {
    Zixflow.shared.screen(title: "Home Screen")
}

In-app inline placements

  • SwiftUI: Use InlineMessage(elementId:)
  • UIKit: Use InlineMessageUIView(elementId:)
See In-App Messaging.

visionOS Support

The SDK supports visionOS with a limited feature set.

Supported Features

  • Core DataPipelines (identify, events, screens)
  • Apple Push Notifications (APNs)
  • In-app messaging
  • Location tracking

Unsupported Features

  • Firebase Cloud Messaging (FCM)

visionOS Setup

import ZixflowDataPipelines

let config = SDKConfigBuilder(apiKey: "YOUR_API_KEY")
    .logLevel(.debug)
    .build()

Zixflow.initialize(withConfig: config)