Skip to Content

Installation

Add the SDK

In Xcode:

  1. FileAdd Package Dependencies…
  2. Enter: https://github.com/AttributeHQ/ios-sdk.git
  3. Select version rule: Up to Next Major Version from 1.0.0

Or in Package.swift:

dependencies: [ .package(url: "https://github.com/AttributeHQ/ios-sdk.git", from: "1.0.0") ]

Initialize the SDK

In your AppDelegate.swift:

import AttributeHQ func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { let config = AttributeHQConfiguration( apiKey: "ak_your_api_key", appId: "your-app-uuid" ) do { try AttributeHQ.shared.initialize(configuration: config) } catch { print("AttributeHQ init error: \(error)") } return true }

Or in a SwiftUI app:

import SwiftUI import AttributeHQ @main struct MyApp: App { init() { let config = AttributeHQConfiguration( apiKey: "ak_your_api_key", appId: "your-app-uuid" ) try? AttributeHQ.shared.initialize(configuration: config) } var body: some Scene { WindowGroup { ContentView() } } }

Configuration Options

OptionTypeDefaultDescription
apiKeyStringRequired. API key from dashboard
appIdStringRequired. App UUID from dashboard
enableDebugLoggingBoolfalsePrint debug logs to console
batchSizeInt10Events per batch before auto-flush
flushIntervalTimeInterval5Seconds between auto-flush
maxQueueSizeInt100Max events in offline queue
requestATTOnInitBooltrueAuto-request ATT permission on init
attDelaySecondsTimeInterval0Delay before ATT prompt

Set requestATTOnInit: false if you want to show the ATT prompt at a custom time (e.g., after onboarding). Call requestATTPermission() manually when ready.

Required Frameworks

The SDK uses these frameworks (linked automatically via SPM/CocoaPods):

FrameworkRequiredPurpose
AdSupportWeakIDFA collection
AppTrackingTransparencyWeakATT permission prompt
StoreKitWeakSKAdNetwork conversion values
AdServicesWeakApple Search Ads attribution

All frameworks are weak-linked — the app works even on devices where they’re unavailable.