Skip to content

iOS quickstart

In a few minutes your iOS app will read a real feature flag — with caching, offline fallback, and the device identity handled for you.

Requires iOS 17, macOS 14, or visionOS 1. The SDK has no dependencies of its own.

The SDK is pre-release and its repository isn’t public yet. If your team has been given access, install it as a Swift Package; the coordinates below are where it lives.

Add the package in Xcode (File → Add Package Dependencies…) or in Package.swift:

.package(url: "https://github.com/FortressFlag/FortressFlag_SDK_ios.git", from: "0.1.0")

Once, at launch — for SwiftUI, your App’s init is the natural place:

import FortressFlag
FortressFlag.start(
Configuration(
sdkKey: "ffc_prod_…", // from your project's SDK keys screen
environment: .production,
keychainAccessGroup: "com.acme.fortressflag" // same string in every app you ship
)
)

start returns as soon as cached values are loaded, and the SDK polls for changes in the background from then on. The key is a client key — it ships in your app by design.

Anywhere, including inside a SwiftUI body:

if FortressFlag.isEnabled("new-checkout") {
NewCheckoutView()
} else {
LegacyCheckoutView()
}

String and number flags read the same way — FortressFlag.stringValue("checkout-cta", default: "buy-now") — and you can watch for changes with FortressFlag.onChange.

That’s it — your flag is live. Toggle it in the dashboard and the app follows within its next poll.

No call in this API throws, blocks, or can crash your app. Every read resolves through a cascade — the last values received, then the durable cache from previous runs, then your call-site default — so an outage, a dead network, or a revoked key never reaches your users.

Set up keychain sharing — it costs you money not to

Section titled “Set up keychain sharing — it costs you money not to”

FortressFlag bills per device, not per app. One phone running three of your apps is one seat — but only if all three agree on one device identity, which on iOS means a shared keychain access group:

  1. In each app target: Signing & Capabilities → + Capability → Keychain Sharing.
  2. Add the same group to every one of your apps — for example com.acme.fortressflag.
  3. Pass that string (without the team prefix) as keychainAccessGroup.

Skip this and everything still works, but each app stores its own identity: one device counts as three billable devices. The SDK logs a warning once when that’s happening.

One platform note: the identity lives in the keychain, so on iOS it survives app uninstalls — and it’s never synced to iCloud, so it never rides a backup onto a second device.

The package ships a second library, FortressFlagDebugUI, with FlagListView — a SwiftUI screen showing every flag this device holds, its value, and where it came from, live. It’s the fastest answer to “is the SDK even talking to the server?”.