Core Methods
| Method | Signature | Description |
|---|---|---|
configure | AppDNA.configure(apiKey: String, environment: Environment, options: AppDNAOptions?) | Initialize the SDK. Call once at app launch. |
identify | AppDNA.identify(userId: String, traits: [String: Any]?) | Associate events with a user identity. |
reset | AppDNA.reset() | Clear user identity and flush events. Call on logout. |
track | AppDNA.track(event: String, properties: [String: Any]?) | Track a custom event with optional properties. |
flush | AppDNA.flush() | Force an immediate flush of all queued events. |
onReady | AppDNA.onReady(_ callback: @escaping () -> Void) | Register a callback for when the SDK is fully initialized. |
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. |
Config Methods
| Method | Signature | Description |
|---|---|---|
getRemoteConfig | AppDNA.getRemoteConfig(key: String) -> Any? | Get a remote config value by key. |
isFeatureEnabled | AppDNA.isFeatureEnabled(flag: String) -> Bool | Check if a feature flag is enabled. |
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) -> [String: Any]? | Get the full config 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) | Track that a push notification was delivered. |
trackPushTapped | AppDNA.trackPushTapped(pushId: String, action: String?) | Track that a push notification was tapped. |
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?) | Present a paywall by ID. |
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() async -> DeferredDeepLink? | Check for a deferred deep link from install attribution. |
Module Namespaces
Access module-specific functionality through these properties on theAppDNA singleton:
| Property | Type | Description |
|---|---|---|
AppDNA.push | 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
AppDNAPushDelegate
AppDNABillingDelegate
AppDNAOnboardingDelegate
AppDNAPaywallDelegate
AppDNAInAppMessageDelegate
AppDNASurveyDelegate
AppDNADeepLinkDelegate
Key Types
AppDNAOptions
Environment
LogLevel
BillingProvider
PaywallContext
OnboardingContext
PushPayload
PushAction
TransactionInfo
ProductInfo
Entitlement
WebEntitlement
DeferredDeepLink
PaywallAction
DismissReason
Properties
| Property | Type | Description |
|---|---|---|
AppDNA.sdkVersion | String | The current SDK version string (e.g., “1.0.0”). |
AppDNA.currentBundleVersion | Int | The current config bundle version number. |
AppDNA.configUpdated | Notification.Name | Notification posted when remote config is updated. |