Skip to content
Proofline

Quickstart · iOS

iOS quickstart (SwiftUI and UIKit)

About five minutes. You need iOS 15 or later (StoreKit 2), Xcode 16, your app’s publishable key from App settings → Publishable key, and your Proofline platform URL, https://app.proofline.link.

Each app has one publishable key (pk_live_…; a local development server issues pk_test_…). Use the same key in debug and release builds: sandbox purchases are told apart by the store’s environment, not by the key. See Testing and sandbox.

1. Add the package

In Xcode, choose File → Add Package Dependencies…, paste the package URL we sent you, and add the Proofline library to your app target.

2. Configure at launch

import Proofline
import SwiftUI

@main
struct StretchlyApp: App {
    init() {
        Proofline.configure(
            appKey: "pk_live_…",
            // Your Proofline platform: every SDK request goes here.
            baseURL: URL(string: "https://app.proofline.link")!
        )
    }

    var body: some Scene {
        WindowGroup {
            ContentView()
                // Creator links and universal links carry a click ID in the URL path.
                .onOpenURL { url in Proofline.handle(url) }
        }
    }
}

Always pass baseURL: it is your Proofline platform, https://app.proofline.link, and every SDK request goes there. The SDK never throws, so with a wrong or missing host nothing fails visibly; it just records no clicks, users or codes. The Integration Doctor shows whether events arrive.

In UIKit, call Proofline.handle(userActivity) from scene(_:continue:) for universal links and Proofline.handle(url) from scene(_:openURLContexts:).

Every call except identify is non-throwing and safe before configure finishes. Work runs off the main thread; nothing in the SDK can crash your app.

3. Identify the user and pass the token to StoreKit

The token ties every purchase, renewal and refund to the user, including purchases made outside your app such as offer-code redemptions in the App Store.

let token = try await Proofline.identify(userID: user.id)
let result = try await product.purchase(options: [.appAccountToken(token)])

If you prefer not to handle errors, await Proofline.appAccountToken(userID:) returns nil instead of throwing.

4. Add code entry to your paywall

A code typed or pasted into your app is a user-asserted signal (UUser-asserted). If the code is one of your Apple offer codes, the SDK opens Apple’s redemption sheet so the purchase becomes store-verified (VVerified).

let result = await Proofline.submitCode(code)  // the text from your code field

To let users paste without a clipboard prompt, use the SwiftUI paste button. It wraps Apple’s UIPasteControl (iOS 16+), so the SDK only sees the clipboard after the user taps it.

PasteCodeButton()

5. Show the creator on your paywall (optional)

if let creator = await Proofline.currentAttribution() {
    offerLabel.text = "\(creator.creator.name)'s \(creator.offerLabel ?? "offer")"
}

6. Sync to RevenueCat (if you use it)

This writes proofline_* subscriber attributes, so every RevenueCat webhook carries the creator and the creator appears in RevenueCat Charts.

await Proofline.syncToRevenueCat { attrs in
    Purchases.shared.attribution.setAttributes(attrs)
}

Next