SDK
iOS SDK (Swift)
Native Swift package for creator install attribution and promo-code offers. Works without IDFA and without an App Tracking Transparency prompt. Cold-install matching is scored and best-effort. Details: How attribution works.
Prerequisites
- iOS 15+, Xcode 15+, Swift 5.9+
- A Tap App Link SDK key from Quick start
1. Add the Swift package
Xcode → File → Add Package Dependencies, then:
https://github.com/tapapplink/tapapplink-iosIn a Package.swift:
.package(url: "https://github.com/tapapplink/tapapplink-ios", from: "0.1.1")2. Configure, track, identify
Call from your App init or application(_:didFinishLaunchingWithOptions:).
import TapAppLink
import RevenueCat
TapAppLink.configure(.init(
publicKey: "YOUR_TAPAPPLINK_KEY",
environment: .production
))
try await TapAppLink.trackInstall()
try await TapAppLink.setAppUserId(Purchases.shared.appUserID)
if let offer = TapAppLink.getOffer(),
let offeringId = offer.billingOfferId {
// Present the RevenueCat offering with this identifier
}3. Discount codes
try await TapAppLink.applyCode("SARAH10")
let offer = TapAppLink.getOffer()Present the RevenueCat (or other) offering in getOffer()?.billingOfferId. Full guide: Discount codes.
SDK reference
| Method | Purpose |
|---|---|
configure | Set public key, environment, optional ingest URL. |
trackInstall() | First open. Matches a recent click in this environment. |
setAppUserId(id) | Bridge the billing customer id for webhooks. |
getOffer() | Creator discount after a match or redeem. |
applyCode(code) | Attribute from a promo code typed at checkout. |
resetForTesting() | Clear cached install state in debug builds. |
Important notes
trackInstall()is safe on every launch. It only records once per install.- Call
resetForTesting()in debug builds before repeating a match test on the same install. - Purchases are attributed through billing webhooks. Do not add a client
trackPurchase()call. - After a match or
applyCode(), presentgetOffer()on the paywall. Discount codes.