- iOS 15+ and macOS 12+, Swift 6, Xcode 16+
- No dependencies, no analytics and no background work
- Uses only your Program ID, never your API key
Before you start
In Partnero, open Program settings and turn on Enable mobile app claims in the Tracking for mobile apps section. Until then, every claim fails withcodeNotFound.
Copy your Program ID from the program’s Integration page. It’s the same ID as in your PartneroJS snippet.
Install
In Xcode, choose File → Add Package Dependencies and enterhttps://github.com/partnero/partnero-swift. Or add it to Package.swift:
Configure
Callconfigure once at launch, before any claim:
?aff= by default. If yours use another parameter, such as ?ref=DANIEL20, pass referralParameter: "ref".
Claim a code the user enters
Claim the code when the user enters one. Pass the ID your purchases are reported under, such as the RevenueCat app user ID:Purchases.shared.logIn(...), since anonymous IDs are rejected.
If a code is used as both a partner’s link key and a promotion code, say which one the user entered:
Claim from an opened link
When a partner app link or a referral link opens your app, pass the URL on:partnero_code, or from your referral parameter, such as https://example.com/?aff=DANIEL20. The click ID is read from partnero_click. It returns nil without calling Partnero for links with neither.
If the user isn’t signed in yet, store the values and claim after sign-in:
Partnero.claim(clickId:appUserId:).
Claim results and failures
claim returns a ClaimResult with a status:
It throws a
PartneroError:
The SDK never retries on its own. Your app decides whether and when to try again.
Privacy
The SDK sends Partnero the code, the click ID when there is one, the app user ID, the platform and the first launch date. It stores only the first launch date, inUserDefaults, and ships a privacy manifest. List the user ID under App Functionality in your App Store privacy details if you don’t already.