Feato logoFeato

Swift SDK

The Feato Swift SDK provides simple and predictable access to feature flags inside iOS applications.

It is designed to be cache-first, battery-friendly, and fully under application control — without always-on connections or background polling.


Installation

The Feato Swift SDK is distributed via Swift Package Manager.

https://github.com/feato-app/swift-client

Add the package to your Xcode project using File → Add Packages and import it in your code:

import Feato

Setup

Configure Feato once during application startup by providing your project key and environment.

import SwiftUI
import Feato

@main
struct MyApp: App {

  init() {
    Feato.configure(
      projectKey: "YOUR_PROJECT_KEY",
      environment: .prod
    )
  }

  var body: some Scene {
    WindowGroup {
      ContentView()
    }
  }
}
Automatic initial fetch

After configuration, Feato automatically loads cached flags and performs a single background refresh to retrieve the latest state.


Reading feature flags

Feature flags are accessed synchronously and are always available immediately.

if Feato.flag("new-dashboard") {
  NewDashboardView()
}
  • Flags are available synchronously
  • Missing flags resolve to false
  • No async APIs or callbacks required

Refreshing flags

Refreshing feature flags is explicit and fully controlled by the application.

Task {
  await Feato.refresh()
}

Typical refresh moments include:

  • Application launch
  • App entering foreground
  • Pull-to-refresh actions
  • Debug or QA workflows
Failure-safe behavior

If a refresh fails, cached flags remain in use and no errors are propagated into UI code.


Design principles

  • Cache-first and offline-safe
  • No background polling or persistent connections
  • Battery-friendly by design
  • Main-thread safe and SwiftUI friendly

The Swift SDK intentionally avoids real-time streaming and prioritizes predictable behavior in mobile environments.


Next steps

To continue exploring Feato, you may want to review: