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
// 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.
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() }
}
}| Parameter | Type | Default | Description |
|---|---|---|---|
| apiKey | String | — | Your public key (fnl_pk_…). It can read flows and report events, nothing else — safe inside a shipped binary. |
| appVersion | String? | nil | Tags every analytics event, so you can tell which build a funnel number came from. |
| bundleId | String? | nil | Locks the key to your app, so a leaked key is useless elsewhere. |
| trackingEnabled | Bool | true | Start with analytics off for a consent flow, then call setTrackingEnabled(true). |
| redactVariables | Set<String> | [] | Answers named here never leave the device in an event payload, whatever the flow says. |
Next
- Rendering flows — the view, what it hands back, and starting a session yourself.
- Native handlers — the six handoffs, and what each does if you skip it.
- Products & paywalls — real store prices on a paywall.