iOS SDK (Swift) / Install & configure

Install & configure

The native Swift SDK. It is also the engine the Flutter package hosts, which is why a native app and a Flutter app cannot draw the same flow differently.

Requirements

  • iOS 16+, SwiftUI.
  • Swift Package Manager. No third-party dependencies.
  • A public API key from SDK & API in the dashboard.

Install

Package.swift
// Xcode: File ▸ Add Package Dependencies…
// or, in Package.swift:
.package(
    url: "https://github.com/uplift-funnel/uplift-funnel-swift",
    from: "0.10.1"
)

Configure

Once, at startup, before anything else touches the SDK. Every other call throws UpliftFunnelError.notConfigured until it has run, and the message names the call that was too early.

MyApp.swift
import SwiftUI
import UpliftFunnel

@main
struct MyApp: App {
    init() {
        Task {
            await UpliftFunnel.configure(
                apiKey: "fnl_pk_…",           // public key, safe to ship
                appVersion: "2.4.0",          // tags analytics events
                bundleId: Bundle.main.bundleIdentifier
            )
        }
    }

    var body: some Scene {
        WindowGroup { ContentView() }
    }
}
ParameterTypeDefaultDescription
apiKeyStringYour public key (fnl_pk_…). It can read flows and report events, nothing else — safe inside a shipped binary.
appVersionString?nilTags every analytics event, so you can tell which build a funnel number came from.
bundleIdString?nilLocks the key to your app, so a leaked key is useless elsewhere.
trackingEnabledBooltrueStart with analytics off for a consent flow, then call setTrackingEnabled(true).
redactVariablesSet<String>[]Answers named here never leave the device in an event payload, whatever the flow says.

Next