Skip to content

Frak

enum Frak

Entry point. Call initialize(_:) once, then use client.

Frak.initialize(FrakConfig(merchantId: "...", metadata: FrakMetadata(name: "Acme")))
let reward = try await Frak.client.rewards.best(RewardRequest(targetInteraction: "purchase"))

Defined in: Sources/FrakSDK/Frak.swift:10

static var client: FrakClient { get throws }
static var clientOrNull: FrakClient? { get }

Same as client, but nil instead of throwing: for a call site that would just try? it anyway. Exists for parity with the Android surface, and for a call site that reads better without try?.

static var isInitialized: Bool { get }
static func initialize(_ config: FrakConfig)
static func parseReferralLink(_ url: String) -> FrakContext?
static func parseReferralLink(_ url: URL) -> FrakContext?
static func shutdown() async

Tears the SDK down: cancels the background work it owns and drops the client so initialize(_:) can run again with a different FrakConfig.

Not a privacy control — use FrakClient.setTrackingEnabled(_:) for that; shutting the SDK down neither records a consent decision nor erases anything, so a merchant who calls only this has stopped tracking for exactly as long as their process lives. Exists so a host can deterministically release the SDK, and so the facade is testable at all.

Idempotent and safe before initialize(_:).