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.
1. Install
Section titled “1. Install”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")2. Start the SDK
Section titled “2. Start the SDK”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.
3. Read a flag
Section titled “3. Read a flag”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.
If FortressFlag is down, your app isn’t
Section titled “If FortressFlag is down, your app isn’t”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:
- In each app target: Signing & Capabilities → + Capability → Keychain Sharing.
- Add the same group to every one of your apps — for example
com.acme.fortressflag. - 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.
Debugging an integration
Section titled “Debugging an integration”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?”.
Where to next
Section titled “Where to next”- How flags reach your app — what that background poll does
- Device identity and billing — the identity you just configured
- Set up a percentage rollout — ship to 10% first