> ## Documentation Index
> Fetch the complete documentation index at: https://docs.appdna.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# iOS API Reference

> Complete method reference for AppDNASDK

> [!NOTE]
>
> **Supported on:** iOS SDK `1.0.61+`

This is the complete reference for all public methods, properties, types, and delegate protocols in the AppDNA iOS SDK.

## Core Methods

| Method | Signature | Description |
| - | - | - |
| `configure` | `AppDNA.configure(apiKey: String, environment: Environment = .production, options: AppDNAOptions = AppDNAOptions())` | Initialize the SDK. Call once at app launch. |
| `identify` | `AppDNA.identify(userId: String, traits: [String: Any]?)` | Associate events with a user identity. `"unknown"` is reserved on the AppDNA server (its billing endpoints reject it with 400); do not use it as a user id. A trait holding a location answer is stored reduced to what the geocoding providers' terms allow: `{raw_query, place_id}` for a Google answer, `{raw_query, timezone, timezone_offset}` for an answer resolved through Mapbox's permanent geocoding, and `{raw_query}` (the text the user typed) for any other. Pass either the `LocationData` that `getLocationData` returns or the dictionary the onboarding-completed delegate's `responses` holds for that field (`responses[stepId][fieldId]`, a `[String: Any]`); a `LocationData` is sent as the answer dictionary: snake\_case keys, only the fields it has, without the stored answer's legacy `address` alias (for a typed answer `{formatted_address, raw_query}`, where `responses` holds the typed string). Passing a `LocationData` needs iOS SDK 1.0.84 or later; earlier releases cannot serialize it. Any other value that is not a JSON value (string, number, boolean, dictionary, array) is dropped with a logged warning naming its trait, and the rest of the call goes on. `NSNull`, or an optional's `nil` passed as `Any`, as a trait or inside one, is kept and sent as `null`. |
| `reset` | `AppDNA.reset()` | Clear user identity, experiment exposures and in-session message / survey state, and stop the web-entitlement and pending-message observers. It also clears all session data: the values set with `setSessionData`, the onboarding answers and the computed values. It does not flush events (call `flush()` first if you need to). Call on logout. |
| `track` | `AppDNA.track(event: String, properties: [String: Any]?)` | Track a custom event with optional properties. |
| `reportPayingUser` | `AppDNA.reportPayingUser(productId: String?, priceCents: Int?, currency: String?)` | Tell AppDNA this user is in a paid state for a subscription the SDK did not sell (server-side billing, a web checkout, a seat sold by a salesperson). Safe to call on every launch. See [Who counts as a paying user](https://docs.appdna.ai/guides/metered-paying-users.md). |
| `flush` | `AppDNA.flush()` | Force an immediate flush of all queued events. |
| `onReady` | `AppDNA.onReady(_ callback: @escaping () -> Void)` | Register a callback that runs on the main thread once the SDK is ready: the bootstrap has succeeded or failed (at once if it already has). Cached and bundled config are applied by then; the remote config fetch may still be running — use `remoteConfig.onChanged` to pick up the fetched values. |
| `shutdown` | `AppDNA.shutdown()` | Shut down the SDK, flush events, and release resources. |
| `setLogLevel` | `AppDNA.setLogLevel(_ level: LogLevel)` | Change the SDK log level at runtime. |
| `setConsent` | `AppDNA.setConsent(analytics: Bool)` | Set analytics consent. When false, events are dropped silently. |

## Session Data Methods

| Method | Signature | Description |
| - | - | - |
| `setSessionData` | `AppDNA.setSessionData(key: String, value: Any)` | Store a key-value pair in the session data store. Kept across app launches when the value is JSON — a string, number or boolean, or a map / list of those at any depth; a value of another type is kept for this session only. |
| `getSessionData` | `AppDNA.getSessionData(key: String) -> Any?` | Retrieve a session data value by key. |
| `clearSessionData` | `AppDNA.clearSessionData()` | Clear the values set with `setSessionData`. Onboarding answers and computed values are kept (`reset()` clears them). |
| `getLocationData` | `AppDNA.getLocationData(fieldId: String) -> LocationData?` | Location answer of an onboarding location field. After a selected suggestion: `formatted_address`, plus city, state, country, coordinates, timezone and the other fields when there is a value (a missing value is `nil`, never `""`). After typing without selecting: `formatted_address` and `raw_query` only, with `nil` coordinates. `nil` when unanswered. Every field except `formatted_address` is optional. `mapbox_id` is set only on an answer resolved through a permanent Mapbox geocode. It is an opaque marker of that, not a stable place id to look up (for an interpolated address it encodes the request that produced it and runs to hundreds of characters). `place_id` is set only on a Google answer (the Places id the user tapped). When a tapped suggestion cannot be resolved (with Mapbox, no permanent access on the account; with Google, the Geocoding API not enabled on the key; with either, any other provider error or a network failure), the answer is the typed text. On a resolved **Mapbox** answer, an **address** answer's `city` is the place that contains the address, not the street name earlier releases stored; a place, locality, region or country answer keeps its own name as `city`; and a region answer also fills its own `state` / `state_code`, a country answer its own `country` / `country_code`, which earlier releases left empty. On a resolved **Google** answer, `city` is the first of the place's locality, postal town, sublocality or second-level administrative area that Google reports — a city answer's own name, an address answer's town — so a region or country answer has no `city`: its own name is its `state` (a region) or its `country` (a country). See [Location Fields](https://docs.appdna.ai/sdks/ios/onboarding.md#location-fields). |

## Config Methods

| Method | Signature | Description |
| - | - | - |
| `getRemoteConfig` | `AppDNA.getRemoteConfig(key: String) -> Any?` | Get a remote config value by key. |
| `forceRefreshConfig` | `AppDNA.forceRefreshConfig()` | Force an immediate refresh of remote configuration. |
| `isFeatureEnabled` | `AppDNA.isFeatureEnabled(flag: String) -> Bool` | Check if a feature flag is enabled. |

## Map Methods

| Member | Signature | Description |
| - | - | - |
| `registerMapView` | `registerMapView(_ key: String = "default", factory: @escaping ([String: Any]) -> AnyView)` | Draw interactive map blocks (**Interactive (pan & zoom)** on, the default) with your own map view; a non-interactive map draws the built-in static map. It must draw with the app's map engine; a map the console hid is not shown (a map placed directly on a step or in an option's sheet; a map inside a row or a stack from the next SDK release). See [Your own map view](https://docs.appdna.ai/sdks/ios/onboarding.md#your-own-map-view-registermapview). |
| `mapProvider` | `static var mapProvider: String?` | The app-wide map engine: your value, else the app's engine, else the cached one. A map pinned to a provider in the console draws with its pin instead. |

## Experiment Methods

| Method | Signature | Description |
| - | - | - |
| `getExperimentVariant` | `AppDNA.getExperimentVariant(experimentId: String) -> String?` | Get the assigned variant for an experiment. |
| `isInVariant` | `AppDNA.isInVariant(experimentId: String, variantId: String) -> Bool` | Check if the user is in a specific variant. |
| `getExperimentConfig` | `AppDNA.getExperimentConfig(experimentId: String, key: String) -> Any?` | Get a specific config value for an experiment variant. |

## Push Methods

| Method | Signature | Description |
| - | - | - |
| `registerForPush` | `AppDNA.registerForPush() async -> Bool` | Request push permission and register for remote notifications. |
| `setPushToken` | `AppDNA.setPushToken(_ deviceToken: Data)` | Set the APNs device token manually. |
| `setPushPermission` | `AppDNA.setPushPermission(granted: Bool)` | Update the push permission status. |
| `trackPushDelivered` | `AppDNA.trackPushDelivered(pushId: String)` | Manual tracking — **only for pushes the SDK does not see**. It carries no `delivery_id`; combined with forwarding or the notification proxy it double-counts. |
| `trackPushTapped` | `AppDNA.trackPushTapped(pushId: String, action: String?)` | Manual tracking — **only for pushes the SDK does not see** (same caveat). |
| `installNotificationProxy` | `AppDNA.installNotificationProxy()` | Install the notification-centre delegate proxy now if it is not installed yet (main thread). Only needed when your linking drops the SDK's launch-time install; call it **after** you set your own `UNUserNotificationCenter.current().delegate`. Once the proxy is installed it does nothing, so it cannot re-wrap a delegate assigned later — set your delegate in `didFinishLaunching`, or forward with `pushModule.handleMessageData` / `handleNotificationTap`. A no-op when Info.plist `AppDNADisableNotificationProxy` is `YES`. |

### `AppDNA.pushModule` forwarding

For hosts that disable the notification proxy (`AppDNADisableNotificationProxy = YES`) and forward from their own delegate. All three are no-ops returning `false` unless the payload carries the AppDNA marker (`appdna: "1"`); calls are deduplicated per push.

| Method | Signature | Description |
| - | - | - |
| `isAppDNAMessage` | `AppDNA.pushModule.isAppDNAMessage(_ userInfo: [AnyHashable: Any]) -> Bool` | `true` when `userInfo["appdna"] == "1"`. |
| `handleMessageData` | `AppDNA.pushModule.handleMessageData(_ userInfo: [AnyHashable: Any]) -> Bool` | Tracks delivered (with `delivery_id`) and fires `onPushReceived`. Never presents. Call from `willPresent`. `@discardableResult`. |
| `handleNotificationTap` | `AppDNA.pushModule.handleNotificationTap(_ userInfo: [AnyHashable: Any], actionIdentifier: String? = nil) -> Bool` | Tracks tapped (with `delivery_id`), fires `onPushTapped`, and routes the AppDNA action. Call from `didReceive`. `@discardableResult`. |

Delivered / tapped tracking needs an AppDNA server from this release or later (older servers send no `appdna` marker, `push_id` or `delivery_id`, so their pushes are not recognised as AppDNA pushes: no tracking, no callbacks, no tap routing).

## Presentation Methods

| Method | Signature | Description |
| - | - | - |
| `presentOnboarding` | `AppDNA.presentOnboarding(flowId: String?, from: UIViewController, delegate: AppDNAOnboardingDelegate?) -> Bool` | Present an onboarding flow. Returns false if config unavailable. |
| `presentPaywall` | `AppDNA.presentPaywall(id: String, from: UIViewController, context: PaywallContext?, delegate: AppDNAPaywallDelegate?) -> Bool` | Present a paywall by ID. Returns `false` if nothing could present it. |
| `presentPaywall` | `AppDNA.presentPaywall(placement: String, from: UIViewController, context: PaywallContext?, delegate: AppDNAPaywallDelegate?) -> Bool` | Present whichever paywall the Console assigned to a placement. Returns `false` if nothing could present it. |

## Web Entitlements

| Member | Signature | Description |
| - | - | - |
| `webEntitlement` | `AppDNA.webEntitlement: WebEntitlement?` | The current web entitlement, if any. |
| `onWebEntitlementChanged` | `AppDNA.onWebEntitlementChanged(_ callback: @escaping (WebEntitlement?) -> Void)` | Register a callback for web entitlement changes. |

## Deep Links

| Method | Signature | Description |
| - | - | - |
| `checkDeferredDeepLink` | `AppDNA.checkDeferredDeepLink(completion: @escaping (DeferredDeepLink?) -> Void)` | Check for a deferred deep link from install attribution. |

***

## Module Namespaces

Access module-specific functionality through these properties on the `AppDNA` singleton:

| Property | Type | Description |
| - | - | - |
| `AppDNA.pushModule` | `PushModule` | Push notification registration, tokens, and delegates |
| `AppDNA.billing` | `BillingModule` | Products, purchases, entitlements, and restore |
| `AppDNA.onboarding` | `OnboardingModule` | Server-driven onboarding flow presentation |
| `AppDNA.paywall` | `PaywallModule` | Server-driven paywall presentation |
| `AppDNA.remoteConfig` | `RemoteConfigModule` | Remote configuration access |
| `AppDNA.features` | `FeaturesModule` | Feature flag evaluation |
| `AppDNA.experiments` | `ExperimentsModule` | Experiment variant assignment |
| `AppDNA.inAppMessages` | `InAppMessagesModule` | In-app message display |
| `AppDNA.surveys` | `SurveysModule` | User survey presentation |
| `AppDNA.deepLinks` | `DeepLinksModule` | Deep link and deferred deep link handling |

***

## Delegate Protocols

### AppDNALifecycleDelegate

```swift theme={null}
public protocol AppDNALifecycleDelegate: AnyObject {
    /// Fires once on idle → locked. `reason` is `billing_overdue`, `manual_admin` or `org_cancelled`;
    /// `lockedAt` is ISO-8601.
    func onSdkRuntimeLocked(reason: String, lockedAt: String)
    /// Fires once on locked → idle.
    func onSdkRuntimeUnlocked()
    /// Part of a published config could not be decoded and was DROPPED; the rest still renders.
    /// `surface` is the kind (`onboarding_flow`, `paywall`, …), `id` the document when one is
    /// known, and `detail` the CODING PATH and reason — e.g.
    /// `steps[9].content_blocks[3]: Dictionary<String, Any> was null`.
    func onConfigurationIssue(surface: String, id: String?, detail: String)
    /// Fires for EVERY event the SDK tracks, with the properties sent with it, right after the
    /// event is queued. Use it to forward AppDNA analytics into your own pipeline.
    func onEventTracked(name: String, properties: [String: Any])
}
```

Set it with `AppDNA.lifecycleDelegate = self`. Every method has a default no-op, so a host
implements only what it cares about.

> [!NOTE]
>
> **`onEventTracked` fires for every tracked event**, immediately after it is durable in the upload
> queue — so forwarding from it cannot lose an event, and nothing you do in it can stop one being
> sent. It fires on whatever thread tracked the event, which is deliberately **not** always the main
> thread: `track` is called from renderers, timers and background queues. Do not block it, and
> dispatch to the main thread yourself if your handler touches UI.
>
> It is an observer, not a filter — returning does not affect delivery. The SDK's own
> `_sdk_events_dropped` meta-event is not reported through it, so a loss counter can never be
> mistaken for one of your events.

> [!NOTE]
>
> **Onboarding events carry location answers unreduced.** `onboarding_step_completed`'s `selection_data` and
> `onboarding_flow_completed`'s `responses` reach `onEventTracked` as the device stored them: a picked location answer
> arrives whole, with the address, coordinates and time zone of the place the user picked (and a Google answer's place ID). AppDNA reduces an answer to what
> the geocoding providers' terms allow only on its own server, after the event leaves the device. What you store or
> forward from these properties is under your terms with the provider, and for a Google answer (one carrying `place_id`)
> under your terms with Google. A Google answer you show yourself must carry Google's attribution wherever it is shown
> without a Google map.

> [!NOTE]
>
> The SDK also tracks a `sdk_decode_dropped` event carrying the same values, so the fleet view does
> not depend on a host implementing this. The delegate exists so YOUR crash reporter can see your
> own content being dropped.

### AppDNAPushDelegate

```swift theme={null}
protocol AppDNAPushDelegate {
    func onPushTokenRegistered(token: String)
    func onPushReceived(notification: PushPayload, inForeground: Bool)
    func onPushTapped(notification: PushPayload, actionId: String?)
}
```

### AppDNABillingDelegate

```swift theme={null}
protocol AppDNABillingDelegate {
    func onPurchaseCompleted(productId: String, transaction: TransactionInfo)
    func onPurchaseFailed(productId: String, error: Error)
    func onEntitlementsChanged(entitlements: [Entitlement])  // optional; fires with the
                                                             // AppDNA.billing.onEntitlementsChanged closures
    func onRestoreCompleted(restoredProducts: [String])
}
```

Register with `AppDNA.billing.setDelegate(_ delegate: AppDNABillingDelegate?, deliversPurchases: Bool = true)` (or `AppDNA.billingDelegate = …`, which is `deliversPurchases: true`). Any billing delegate drains the late-purchase delivery queue — implement `onPurchaseCompleted`, or pass `deliversPurchases: false` for a delegate that must not receive queued purchases.

`onPurchaseCompleted` fires for every purchase the SDK completes — paywall-driven or direct `AppDNA.billing.purchase(...)`. On `.storeKit2` it also fires for purchases that complete later (interrupted, Ask-to-Buy or offer code), possibly at launch, on `setDelegate` or after `identify`; a purchase made on another device of the same Apple ID may also be reported here, and a late purchase made while another user was signed in is delivered when that user signs in — grant idempotently by `transaction.transactionId`. A refused paywall tap (`providerNotAvailable`) and a re-buy of an owned item fire no `onPurchaseCompleted`.

### AppDNAOnboardingDelegate

```swift theme={null}
protocol AppDNAOnboardingDelegate {
    func onOnboardingStarted(flowId: String)
    func onOnboardingStepChanged(flowId: String, stepId: String, stepIndex: Int, totalSteps: Int)
    func onOnboardingCompleted(flowId: String, responses: [String: Any])
    func onOnboardingDismissed(flowId: String, atStep: Int)

    // Async hooks (optional)
    func onBeforeStepAdvance(flowId: String, fromStepId: String, stepIndex: Int, stepType: String, responses: [String: Any], stepData: [String: Any]?) async -> StepAdvanceResult
    func onBeforeStepRender(flowId: String, stepId: String, stepIndex: Int, stepType: String, responses: [String: Any]) async -> StepConfigOverride?
}
```

### AppDNAPaywallDelegate

```swift theme={null}
protocol AppDNAPaywallDelegate {
    func onPaywallPresented(paywallId: String)
    func onPaywallAction(paywallId: String, action: PaywallAction)
    func onPaywallPurchaseStarted(paywallId: String, productId: String)
    func onPaywallPurchaseCompleted(paywallId: String, productId: String, transaction: TransactionInfo)
    func onPaywallPurchaseFailed(paywallId: String, error: Error)
    func onPaywallDismissed(paywallId: String)
    func onPromoCodeSubmit(paywallId: String, code: String, completion: @escaping (Bool) -> Void)
    func onPostPurchaseDeepLink(paywallId: String, url: String)
    func onPostPurchaseNextStep(paywallId: String)
    func onPaywallRestoreStarted(paywallId: String)
    func onPaywallRestoreCompleted(paywallId: String, productIds: [String])
    func onPaywallRestoreFailed(paywallId: String, error: Error)
}
```

### AppDNAInAppMessageDelegate

```swift theme={null}
public protocol AppDNAInAppMessageDelegate: AnyObject {
    func onMessageShown(messageId: String, trigger: String)
    func onMessageAction(messageId: String, action: String, data: [String: Any]?)
    func onMessageDismissed(messageId: String)
    func shouldShowMessage(messageId: String) -> Bool
}
```

### AppDNASurveyDelegate

```swift theme={null}
protocol AppDNASurveyDelegate {
    func onSurveyPresented(surveyId: String)
    func onSurveyCompleted(surveyId: String, responses: [SurveyResponse])
    func onSurveyDismissed(surveyId: String)
}
```

### AppDNADeepLinkDelegate

```swift theme={null}
public protocol AppDNADeepLinkDelegate: AnyObject {
    func onDeepLinkReceived(url: URL, params: [String: String])
}
```

***

## Key Types

### AppDNAOptions

```swift theme={null}
struct AppDNAOptions {
    let flushInterval: TimeInterval    // init(flushInterval: TimeInterval? = nil); not set: the bootstrap's value if positive, else 30
    let batchSize: Int                 // init(batchSize: Int? = nil); a cap on the network-sized batch; not set: the bootstrap's value is the cap if positive, else no cap (this property then reads 100); below 1 is ignored
    let configTTL: TimeInterval        // init(configTTL: TimeInterval? = nil); not set: the bootstrap's value if positive, else 3600
    let requestedFlushInterval: TimeInterval? // What you passed; nil when not set
    let requestedBatchSize: Int?       // What you passed; nil when not set
    let requestedConfigTTL: TimeInterval?     // What you passed; nil when not set
    let logLevel: LogLevel             // Default: .warning
    let billingProvider: BillingProvider // Default: .storeKit2 (AppDNA's own billing)
    let framework: String              // Default: "native" (wrapper attribution)
    let frameworkVersion: String?      // Default: nil (wrapper's own version)
    let requireConsent: Bool           // Default: false (analytics opt-out)
    let vetoTimeout: TimeInterval      // Default: 5 — bounds every host hook on the Flutter / RN bridges;
                                       // sign-in actions wait at least 120 s and a `refresh` interaction
                                       // max(vetoTimeout, 8 s). In a native iOS host it is unused:
                                       // onBeforeStepAdvance is not timed out, onBeforeStepRender ends at 3 s and
                                       // a `refresh` interaction at 8 s
}
```

### Environment

```swift theme={null}
enum Environment {
    case production
    case sandbox
}
```

### LogLevel

```swift theme={null}
enum LogLevel {
    case none
    case error
    case warning
    case info
    case debug
}
```

### BillingProvider

```swift theme={null}
enum BillingProvider {
    case storeKit2
    case revenueCat
    case adapty(apiKey: String)
    case none
}
```

`.storeKit2` (and omitted) — the SDK owns purchases and finishes transactions. `.revenueCat` / `.adapty` — the provider owns purchases; the SDK never finishes transactions and SDK paywall taps report `providerNotAvailable` — under `.revenueCat` unless RevenueCat is linked into AppDNA (source / vendored builds only), under `.adapty` always (with Adapty linked, restore and entitlements go through Adapty, but the SDK never buys). `.none` — billing disabled; purchase and restore throw `BillingError.providerNotAvailable` ("No billing provider configured"). See [Billing](https://docs.appdna.ai/sdks/ios/billing.md#who-owns-the-transaction).

### Info.plist keys (not runtime options)

| Key | Type | Effect |
| - | - | - |
| `AppDNADisableNotificationProxy` | Boolean | `YES` — the SDK never installs its notification-centre delegate proxy; forward with `AppDNA.pushModule` yourself. |
| `AppDNAForegroundPresentation` | Array of `banner`, `list`, `sound`, `badge` | Foreground presentation of AppDNA pushes (empty array = do not present). Default `[banner, list, sound, badge]`. See [Push](https://docs.appdna.ai/sdks/ios/push.md#how-push-works-on-ios) for its trade-off. |

### PaywallContext

```swift theme={null}
struct PaywallContext {
    let placement: String
    let experiment: String?
    let variant: String?
    let customData: [String: Any]?   // Merged into the `paywall_view` event's properties
}
```

### OnboardingContext

```swift theme={null}
struct OnboardingContext {
    var source: String?
    var campaign: String?
    var referrer: String?
    var userProperties: [String: Any]?
    var experimentOverrides: [String: String]?
}
```

### PushPayload

```swift theme={null}
struct PushPayload {
    let pushId: String
    let title: String
    let body: String
    let imageUrl: String?
    let data: [String: Any]?
    let action: PushAction?       // The notification-body tap-through action
    let actions: [PushAction]     // The registered action BUTTONS (defaults to [])
}
```

### PushAction

```swift theme={null}
struct PushAction {
    let type: String
    let value: String
    let id: String?      // Button identifier — matches `actionId` in onPushTapped. Nil for the body action.
    let label: String?   // Button label as displayed. Nil for the body action.
}
```

### TransactionInfo

```swift theme={null}
struct TransactionInfo {
    var transactionId: String
    var productId: String
    var purchaseDate: Date
    var environment: String
}
```

### ProductInfo

```swift theme={null}
struct ProductInfo {
    var id: String
    var displayName: String
    var description: String
    var price: Decimal
    var displayPrice: String
    var subscription: SubscriptionInfo?
}
```

### Entitlement

```swift theme={null}
struct Entitlement {
    var identifier: String
    var isActive: Bool
    var expiresAt: Date?
    var productId: String
}
```

### WebEntitlement

```swift theme={null}
struct WebEntitlement {
    let isActive: Bool
    let planName: String?
    let priceId: String?
    let interval: String?            // "month", "year"
    let status: EntitlementStatus
    let currentPeriodEnd: Date?
    let trialEnd: Date?
}
```

### DeferredDeepLink

```swift theme={null}
struct DeferredDeepLink {
    var screen: String
    var params: [String: String]
    var visitorId: String
}
```

### PaywallAction

```swift theme={null}
enum PaywallAction {
    case ctaTapped
    case featureSelected
    case planChanged
    case linkTapped
    case custom
}
```

### DismissReason

```swift theme={null}
enum DismissReason {
    case purchased
    case dismissed
    case tappedOutside
    case programmatic
}
```

### StepAdvanceResult

```swift theme={null}
enum StepAdvanceResult {
    case proceed
    case proceedWithData([String: Any])
    case block(message: String)
    case skipTo(stepId: String)
    case skipToWithData(stepId: String, data: [String: Any])
    case stay(message: String? = nil)
}

extension StepAdvanceResult {
    /// 120 s for a sign-in action (`stepData["action"]` is one of the sign-in actions), else `nil`.
    public static func minimumBridgeTimeout(stepData: [String: Any]?) -> TimeInterval?
}
```

`minimumBridgeTimeout(stepData:)` is the floor the Flutter and React Native bridges apply to `onBeforeStepAdvance`: they wait `max(vetoTimeout, minimumBridgeTimeout(stepData:) ?? 0)`. A native iOS host is not timed out.

### StepConfigOverride

```swift theme={null}
struct StepConfigOverride {
    var fieldDefaults: [String: Any]?
    var title: String?
    var subtitle: String?
    var ctaText: String?
    var fieldOptions: [String: [InputOption]]?  // host-supplied Select options, by block id
    var dataContext: [String: Any]?             // host data for this step, read as {{hook_data.…}}
    var mapRoutes: [String: MapRouteOverride]?  // host-supplied map routes, by block id
}
```

### FormFieldType

```swift theme={null}
enum FormFieldType: String, Codable {
    case text, textarea, number, email, phone
    case password
    case url
    case date, time, datetime
    case select, slider, toggle, stepper, segmented
    case location
    case rating
    case range_slider
    case image_picker
    case color
    case multiline_chips
    case signature
}
```

***

## Server-Driven Screens

| Method | Signature | Description |
| - | - | - |
| `showScreen` | `AppDNA.showScreen(_ screenId: String, completion: ((ScreenResult) -> Void)?)` | Present a server-driven screen by ID. |
| `showFlow` | `AppDNA.showFlow(_ flowId: String, completion: ((FlowResult) -> Void)?)` | Present a multi-screen flow by ID. |
| `dismissScreen` | `AppDNA.dismissScreen()` | Dismiss the currently presented screen or flow. |
| `enableNavigationInterception` | `AppDNA.enableNavigationInterception(forScreens: [String]?)` | Enable automatic screen injection between navigations. Pass nil for all screens. |
| `disableNavigationInterception` | `AppDNA.disableNavigationInterception()` | Disable navigation interception. |
| `previewScreen` | `@discardableResult AppDNA.previewScreen(json: String, completion: ((ScreenResult) -> Void)? = nil) -> Bool` | Preview a screen from raw JSON config. Available in all build configurations. |
| `screenDelegate` | `AppDNA.screenDelegate: AppDNAScreenDelegate?` | Set a delegate for screen lifecycle callbacks. |
| `isConsentGranted` | `AppDNA.isConsentGranted() -> Bool` | Check if analytics consent has been granted. |
| `getUserTraits` | `AppDNA.getUserTraits() -> [String: Any]` | Get the current user traits set via `identify()`. |

***

### AppDNAScreenDelegate

```swift theme={null}
protocol AppDNAScreenDelegate {
    func onScreenPresented(screenId: String)
    func onScreenDismissed(screenId: String, result: ScreenResult)
    func onFlowCompleted(flowId: String, result: FlowResult)
    func onScreenAction(screenId: String, action: SectionAction) -> Bool
}
```

### ScreenError

```swift theme={null}
enum ScreenError: String, Codable {
    case configFetchFailed
    case configFetchTimeout
    case screenNotFound
    case configParseError
    case configInvalid
    case nestingDepthExceeded
}
```

### ScreenResult

```swift theme={null}
struct ScreenResult {
    let screenId: String
    let dismissed: Bool
    let responses: [String: Any]
    let lastAction: String?
    let duration_ms: Int
    let error: ScreenError?
}
```

### FlowResult

```swift theme={null}
struct FlowResult {
    let flowId: String
    let completed: Bool
    let lastScreenId: String
    let responses: [String: Any]
    let screensViewed: [String]
    let duration_ms: Int
    let error: ScreenError?
}
```

### SectionAction

An action a section dispatches through its context. `SectionAction` is an
`enum`, not a struct — each case carries its own associated values.

```swift theme={null}
enum SectionAction {
    case next
    case back
    case dismiss
    case navigate(screenId: String)
    case openURL(url: String)
    case openWebview(url: String)
    case openAppSettings
    case share(text: String)
    case deepLink(url: String)
    case showPaywall(id: String?)
    case showSurvey(id: String?)
    case showScreen(id: String)
    case submitForm(data: [String: Any])
    case track(event: String, properties: [String: Any]?)
    case haptic(type: String)
    case custom(type: String, value: String?)

    // Flow-level verbs (routed by FlowManager; ignored on the single-screen path)
    case restart
    case complete
    case setResponse(key: String, value: Any?)
    case presentPaywall(id: String?)
    case dismissPaywall
    case showMessage(id: String?)
    case setUserProperty(key: String, value: Any?)
    case purchase(productId: String)
    case restore
}
```

***

## Properties

| Property | Type | Description |
| - | - | - |
| `AppDNA.sdkVersion` | `String` | The current SDK version string (e.g., "1.0.85"). |
| `AppDNA.configUpdated` | `Notification.Name` | Notification posted when remote config is updated. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.