Flags
A flag (a.k.a. gate) evaluates to a Bool for the bound user.
Generated from the SDK's own /docs/ — also served raw at
https://shipeasy-ai.github.io/sdk-swift/pages/flags.md.
A flag (a.k.a. gate) evaluates to a Bool for the bound user.
let client = try Client(["user_id": "u_123", "plan": "pro"])
let enabled = await client.getFlag("new_checkout")getFlag returns false when the rules aren't ready yet or the gate is absent.
Default / fallback behaviour
getFlag takes an optional default returned only when the value cannot be
evaluated (rules not ready, or the gate doesn't exist) — never when the gate
simply evaluates to false:
let on = await client.getFlag("new_checkout", default: true)A flag that exists and evaluates to false still returns false; the default
is purely a "can't decide yet" fallback.
Evaluation detail
getFlagDetail returns both the value and the reason it resolved that way —
useful for debugging targeting and rollout. getFlag is getFlagDetail().value.
let d = await client.getFlagDetail("new_checkout")
// d.value -> Bool
// d.reason -> one of the FlagReason raw values (String)| Reason | Meaning |
|---|---|
OVERRIDE | A local overrideFlag supplied the value |
CLIENT_NOT_READY | No live rules yet (haven't fetched) |
FLAG_NOT_FOUND | The gate name isn't in the flags blob |
OFF | The gate exists but is disabled / killed |
RULE_MATCH | The gate evaluated to true (rules + rollout match) |
DEFAULT | The gate evaluated to false (not targeted) |
Configuration
configure(...) wires the API key, HTTP, the rules cache, and (optionally) the background poll. Call it once at startup. It is idempotent — the first call…
Dynamic configs
A dynamic config is a typed JSON value (string, number, bool, array, or object) fetched by name. Configs are not user-scoped — they resolve the same for any…