Shipeasy
ReferenceSwift

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)
ReasonMeaning
OVERRIDEA local overrideFlag supplied the value
CLIENT_NOT_READYNo live rules yet (haven't fetched)
FLAG_NOT_FOUNDThe gate name isn't in the flags blob
OFFThe gate exists but is disabled / killed
RULE_MATCHThe gate evaluated to true (rules + rollout match)
DEFAULTThe gate evaluated to false (not targeted)
Was this page helpful?
✎ Edit this page

On this page