PactDOCS

Integrate / iOS

Native iOS SDK

Use one native Swift consent client for managed SwiftUI and fully headless product experiences.
01

Install from pinned source

Vendor or submodule a reviewed Pact revision, then add that directory as a local package in Xcode. The package supports iOS 15 and newer.

Package.swift
swift
dependencies: [
    .package(path: "Vendor/pact")
]

// Target dependency:
.product(name: "PactConsent", package: "pact")
02

Create the native client

The bundle ID is an approved deployment binding. The consent scope—not the bundle ID—groups compatible web and mobile properties under one policy version.

AppConsent.swift
swift
import PactConsent

let consent = PactConsentClient(configuration: PactConfiguration(
    baseURL: URL(string: "https://consent.example.com")!,
    tenantId: "acme",
    consentScopeId: "customer-account",
    policyVersion: "policy-2026-08",
    region: "EU",
    binding: .ios(bundleIdentifier: "com.example.app"),
    purposes: [
        .init(id: .essential, displayName: "Essential", description: "Required", required: true),
        .init(id: .analytics, displayName: "Measurement", description: "Understand product use"),
        .init(id: .marketing, displayName: "Advertising", description: "Relevant advertising")
    ]
))
03

Use managed SwiftUI

PrivacySettingsView.swift
swift
import PactConsent
import SwiftUI

struct PrivacySettingsView: View {
    @ObservedObject var consent: PactConsentClient

    var body: some View {
        PactPrivacyButton(client: consent)
        // Or present PactConsentView(client: consent) directly.
    }
}
04

Use the headless API

The client owns state and evidence while your application owns every visible element.

PrivacyModel.swift
swift
consent.deny([.marketing])
consent.save([.analytics: true, .marketing: false])

if consent.isAllowed(.analytics) {
    startMeasurement()
}
NextInstall the Android SDK