# Frak

```swift
enum Frak
```

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

```swift
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](https://github.com/frak-id/wallet/blob/35995d05c807efe1e0d6319fdede3ad363124d1e/sdk/ios/Sources/FrakSDK/Frak.swift#L10)

## Type properties

### client

```swift
static var client: FrakClient { get throws }
```

### clientOrNull

```swift
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?`.

### isInitialized

```swift
static var isInitialized: Bool { get }
```

## Type methods

### initialize(_:)

```swift
static func initialize(_ config: FrakConfig)
```

### parseReferralLink(_:)

```swift
static func parseReferralLink(_ url: String) -> FrakContext?
```

### parseReferralLink(_:)

```swift
static func parseReferralLink(_ url: URL) -> FrakContext?
```

### shutdown()

```swift
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(_:)`.