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

Core Methods

MethodSignatureDescription
configureAppDNA.configure(apiKey: String, environment: Environment, options: AppDNAOptions?)Initialize the SDK. Call once at app launch.
identifyAppDNA.identify(userId: String, traits: [String: Any]?)Associate events with a user identity.
resetAppDNA.reset()Clear user identity and flush events. Call on logout.
trackAppDNA.track(event: String, properties: [String: Any]?)Track a custom event with optional properties.
flushAppDNA.flush()Force an immediate flush of all queued events.
onReadyAppDNA.onReady(_ callback: @escaping () -> Void)Register a callback for when the SDK is fully initialized.
shutdownAppDNA.shutdown()Shut down the SDK, flush events, and release resources.
setLogLevelAppDNA.setLogLevel(_ level: LogLevel)Change the SDK log level at runtime.
setConsentAppDNA.setConsent(analytics: Bool)Set analytics consent. When false, events are dropped silently.

Config Methods

MethodSignatureDescription
getRemoteConfigAppDNA.getRemoteConfig(key: String) -> Any?Get a remote config value by key.
isFeatureEnabledAppDNA.isFeatureEnabled(flag: String) -> BoolCheck if a feature flag is enabled.

Experiment Methods

MethodSignatureDescription
getExperimentVariantAppDNA.getExperimentVariant(experimentId: String) -> String?Get the assigned variant for an experiment.
isInVariantAppDNA.isInVariant(experimentId: String, variantId: String) -> BoolCheck if the user is in a specific variant.
getExperimentConfigAppDNA.getExperimentConfig(experimentId: String) -> [String: Any]?Get the full config for an experiment variant.

Push Methods

MethodSignatureDescription
registerForPushAppDNA.registerForPush() async -> BoolRequest push permission and register for remote notifications.
setPushTokenAppDNA.setPushToken(_ deviceToken: Data)Set the APNs device token manually.
setPushPermissionAppDNA.setPushPermission(granted: Bool)Update the push permission status.
trackPushDeliveredAppDNA.trackPushDelivered(pushId: String)Track that a push notification was delivered.
trackPushTappedAppDNA.trackPushTapped(pushId: String, action: String?)Track that a push notification was tapped.

Presentation Methods

MethodSignatureDescription
presentOnboardingAppDNA.presentOnboarding(flowId: String?, from: UIViewController, delegate: AppDNAOnboardingDelegate?) -> BoolPresent an onboarding flow. Returns false if config unavailable.
presentPaywallAppDNA.presentPaywall(id: String, from: UIViewController, context: PaywallContext?, delegate: AppDNAPaywallDelegate?)Present a paywall by ID.

Web Entitlements

MemberSignatureDescription
webEntitlementAppDNA.webEntitlement: WebEntitlement?The current web entitlement, if any.
onWebEntitlementChangedAppDNA.onWebEntitlementChanged(_ callback: @escaping (WebEntitlement?) -> Void)Register a callback for web entitlement changes.
MethodSignatureDescription
checkDeferredDeepLinkAppDNA.checkDeferredDeepLink() async -> DeferredDeepLink?Check for a deferred deep link from install attribution.

Module Namespaces

Access module-specific functionality through these properties on the AppDNA singleton:
PropertyTypeDescription
AppDNA.pushPushModulePush notification registration, tokens, and delegates
AppDNA.billingBillingModuleProducts, purchases, entitlements, and restore
AppDNA.onboardingOnboardingModuleServer-driven onboarding flow presentation
AppDNA.paywallPaywallModuleServer-driven paywall presentation
AppDNA.remoteConfigRemoteConfigModuleRemote configuration access
AppDNA.featuresFeaturesModuleFeature flag evaluation
AppDNA.experimentsExperimentsModuleExperiment variant assignment
AppDNA.inAppMessagesInAppMessagesModuleIn-app message display
AppDNA.surveysSurveysModuleUser survey presentation
AppDNA.deepLinksDeepLinksModuleDeep link and deferred deep link handling

Delegate Protocols

AppDNAPushDelegate

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

AppDNABillingDelegate

protocol AppDNABillingDelegate {
    func onPurchaseCompleted(productId: String, transaction: TransactionInfo)
    func onPurchaseFailed(productId: String, error: Error)
    func onEntitlementsChanged(entitlements: [Entitlement])
    func onRestoreCompleted(restoredProducts: [String])
}

AppDNAOnboardingDelegate

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)
}

AppDNAPaywallDelegate

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)
}

AppDNAInAppMessageDelegate

protocol AppDNAInAppMessageDelegate {
    func onMessagePresented(messageId: String)
    func onMessageAction(messageId: String, action: String)
    func onMessageDismissed(messageId: String)
}

AppDNASurveyDelegate

protocol AppDNASurveyDelegate {
    func onSurveyPresented(surveyId: String)
    func onSurveyCompleted(surveyId: String, responses: [String: Any])
    func onSurveyDismissed(surveyId: String)
}

AppDNADeepLinkDelegate

protocol AppDNADeepLinkDelegate {
    func onDeepLinkReceived(deepLink: DeferredDeepLink)
}

Key Types

AppDNAOptions

struct AppDNAOptions {
    var flushInterval: TimeInterval   // Default: 30
    var batchSize: Int                // Default: 20
    var configTTL: TimeInterval       // Default: 300
    var logLevel: LogLevel            // Default: .warning
    var billingProvider: BillingProvider // Default: .storeKit2
}

Environment

enum Environment {
    case production
    case sandbox
}

LogLevel

enum LogLevel {
    case none
    case error
    case warning
    case info
    case debug
}

BillingProvider

enum BillingProvider {
    case storeKit2
    case revenueCat
    case adapty(apiKey: String)
    case none
}

PaywallContext

struct PaywallContext {
    var placement: String
    var experiment: String?
    var variant: String?
}

OnboardingContext

struct OnboardingContext {
    var source: String?
    var campaign: String?
    var referrer: String?
    var userProperties: [String: Any]?
    var experimentOverrides: [String: String]?
}

PushPayload

struct PushPayload {
    var pushId: String
    var title: String
    var body: String
    var imageUrl: String?
    var data: [String: Any]?
    var action: PushAction?
}

PushAction

struct PushAction {
    var type: String
    var value: String
}

TransactionInfo

struct TransactionInfo {
    var transactionId: String
    var productId: String
    var purchaseDate: Date
    var environment: String
}

ProductInfo

struct ProductInfo {
    var id: String
    var displayName: String
    var description: String
    var price: Decimal
    var displayPrice: String
    var subscription: SubscriptionInfo?
}

Entitlement

struct Entitlement {
    var identifier: String
    var isActive: Bool
    var expiresAt: Date?
    var productId: String
}

WebEntitlement

struct WebEntitlement {
    var identifier: String
    var isActive: Bool
    var source: String
    var expiresAt: Date?
}
struct DeferredDeepLink {
    var url: URL
    var campaign: String?
    var medium: String?
    var source: String?
    var data: [String: Any]?
}

PaywallAction

enum PaywallAction {
    case ctaTapped
    case featureSelected
    case planChanged
    case linkTapped
    case custom
}

DismissReason

enum DismissReason {
    case purchased
    case dismissed
    case tappedOutside
    case programmatic
}

Properties

PropertyTypeDescription
AppDNA.sdkVersionStringThe current SDK version string (e.g., “1.0.0”).
AppDNA.currentBundleVersionIntThe current config bundle version number.
AppDNA.configUpdatedNotification.NameNotification posted when remote config is updated.