Overview
Shipeasy is the native client Swift SDK for Shipeasy — feature flags, dynamic configs, kill switches, and A/B experiments for an iOS / macOS / tvOS /…
/docs/ — also served raw at https://shipeasy-ai.github.io/sdk-swift/pages/overview.md.Shipeasy is the native client Swift SDK for Shipeasy —
feature flags, dynamic configs, kill switches, and A/B experiments for an
iOS / macOS / tvOS / watchOS app. It uses a public client key (pk_…, safe
to embed in a shipped app), evaluates one device user server-side over
POST /sdk/evaluate, and serves cheap local reads from the cached response.
Mental model: configureClient() once, then identify + read
You call configureClient(clientKey:) once at app launch. It returns a
ShipeasyClient and registers it as the process-global one (fetch it later with
shipeasyClient()). Then you identify(...) the device user (which evaluates and
caches assignments) and read flags/configs/experiments from the cache:
import Shipeasy
// Once, at app launch — PUBLIC client key (pk_…), safe to embed:
let client = configureClient(clientKey: "pk_live_…")
// Bind the user (pass [:] for a logged-out visitor). Awaiting the first identify
// guarantees the first reads see assignments:
await client.identify(["user_id": "u_123", "plan": "pro"])
// Reads serve the cached /sdk/evaluate response (no per-call network):
let enabled = await client.getFlag("new_checkout")ShipeasyClient is a Swift actor, so its methods are async — you await
them. Reads are served from a local cache of the last /sdk/evaluate
response, so they never hit the network and are safe from any thread. Before the
first identify, reads return the supplied defaults.
The persisted device anonymous_id is the whole point of the client SDK: it
survives cold starts so a logged-out visitor buckets identically into every
fractional rollout and experiment on every launch. See
configuration and advanced.
The things you use
| Function / type | Role |
|---|---|
configureClient(...) | Called once at app launch. Wires the client key, HTTP, and the anon-id store; returns the ShipeasyClient and registers it globally. First-config-wins (idempotent). See configuration. |
shipeasyClient() | Fetch the configured client (ShipeasyClient?), or nil if configureClient hasn't run. |
client.identify(_:) | Bind the device user + refresh assignments over /sdk/evaluate. Call at launch, on login, and whenever targeting attributes change. |
client.reset() | Logout: clear user_id, keep the device anonymous_id, re-evaluate as anonymous. |
client.getFlag/getConfig/getKillswitch | Cached reads for the current user. |
client.universe(_:).assign() | Assign the user within a universe (a mutual-exclusion pool — the user lands in at most one of its experiments) and read the resolved params. Auto-logs one exposure when enrolled. |
client.track(_:properties:) | Conversion telemetry (fire-and-forget). |
see(_:) family | Structured error reporting. See error-reporting. |
Pages
- installation — SwiftPM dependency, platforms, where to call
configureClient, and custom anon-id stores. - configuration —
configureClient(...), every option, the persisted anon-id,shipeasyClient(). - flags —
getFlag, defaults. - configs —
getConfig, defaults, typed reads. - killswitches —
getKillswitch+ named override switches. - error-reporting —
see()structured error reporting. - testing — hermetic tests with an in-memory store + a stub transport.
- openfeature — provider status (not shipped).
- advanced — private attributes, custom
AnonymousStore,anonymousId,refreshAssignments.
Agent skill
Installable LLM skill for the PHP SDK (configure() + Client(user), evaluate, experiment + track, testing).
Installation & configuration
The Swift SDK is a native client SDK, distributed via SwiftPM. It uses a public client key (pk…, safe to embed in a shipped app). Requires iOS 15+ / macOS…