Skip to main content

iOS SDK for Swift

Add install tracking and purchase attribution to your iOS app. Supports SwiftUI and UIKit. No IDFA, no ATT prompt, zero dependencies.

Quick start

Track your first install in under 5 minutes.

import Appfiliate

// In your App init() or AppDelegate:
Appfiliate.configure(appId: "APP_ID", apiKey: "API_KEY")
Appfiliate.trackInstall()

Get your App ID and API Key from your Appfiliate dashboard.

Integration guide

Step-by-step instructions to integrate the Appfiliate iOS SDK.

1

Add the Swift Package

In Xcode, go to File → Add Package Dependencies and paste the repository URL:

https://github.com/Appfiliate-sdk/appfiliate-ios-sdk

Select version 1.0.0 or later.

2

Configure and track installs

Find your app's entry point — the @main struct or AppDelegate. Add the following:

import Appfiliate

@main
struct MyApp: App {
    init() {
        Appfiliate.configure(appId: "APP_ID", apiKey: "API_KEY")
        Appfiliate.trackInstall()
    }

    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}

trackInstall() only fires once per install — it's safe to call on every launch.

3

Track purchases (optional)

After a successful in-app purchase via StoreKit, call trackPurchase():

Appfiliate.trackPurchase(
    productId: product.id,
    revenue: price,
    currency: "USD",
    transactionId: transaction.id
)
4

Set user ID for webhooks (optional)

If you use RevenueCat, Superwall, Adapty, Qonversion, or Stripe, link the user ID so purchases are attributed automatically:

// RevenueCat example
Appfiliate.setUserId(Purchases.shared.appUserID)

// Stripe example
Appfiliate.setUserId(stripeCustomerId)

Automatic Purchase Tracking

RevenueCat webhook integration

Connect RevenueCat and every purchase, renewal, and cancellation is attributed automatically. No manual trackPurchase() calls needed.

1. Add one line of code

Appfiliate.configure(appId: "APP_ID", apiKey: "API_KEY")
Appfiliate.trackInstall()
Appfiliate.setUserId(Purchases.shared.appUserID)

2. Paste the webhook URL

In your RevenueCat dashboard, go to Integrations → Webhooks and paste:

https://us-central1-appfiliate-5a18b.cloudfunctions.net/api/v1/webhooks/revenuecat

Start tracking iOS installs today

3 lines of code. No IDFA. No ATT prompt. Free plan included.