Skip to main content

UIKit vs SwiftUI

UIKit Initialization

Use AppDelegate for UIKit apps:
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
    func application(
        _ application: UIApplication,
        didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
    ) -> Bool {
        // Initialize SDK here
        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: Manual screen tracking recommended:
// In SwiftUI views
.onAppear {
    Zixflow.shared.screen(title: "Home Screen")
}

visionOS Support

The SDK supports visionOS with limited features.

Supported Features

  • Core DataPipelines (user identification, event tracking)
  • Apple Push Notifications (APNs)
  • 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)