VoidhashDocs
DocumentationAPI reference
Dashboard
Get started
Introduction
Quickstart
Setup
Setup overview
Create a project
Products and perks
Paywall locations
CLI
Paywall components
Components
Develop a component
Editor panels
Component definition
Publishing
Installing and capabilities
Mobile SDKs
Swift
Kotlin
React Native
Store setup
Connect the App Store
Connect Google Play
API libraries
Node.js
PHP
Rust
Go
Resources
MCP server
Migrate in observer mode
Delete a person's data
Swift SDK
Check access
Identify customers
Evaluate feature flags
Capture analytics
Track screens
Errors

Evaluate feature flags

Gate features with remotely evaluated flags and variants.

Feature flags let you turn features on or off, and pick variants, without shipping a new build. Voidhash evaluates every flag for the current person, so the same flag can resolve differently for different customers. Use flags for staged rollouts, experiments, and remote configuration.

Evaluate flags

Pass the keys you need. Pass nil instead to evaluate every flag in the project:

let flags = try await voidhash.getFeatureFlags(["new-onboarding", "pricing-test"])

let newOnboarding = flags.first { $0.key == "new-onboarding" }?.enabled == true
let pricing = flags.first { $0.key == "pricing-test" }

Each result carries the flag's key, whether it is enabled, and the variantKey of the variant the customer was assigned.

Read a variant's payload

A variant can carry a payload, such as a headline or a pricing configuration. payload is a JSONValue, or nil when the variant has none. Payloads are untyped JSON, so validate a payload before you use it:

let pricing = try await voidhash.getFeatureFlags(["pricing-test"]).first

if case .object(let config)? = pricing?.payload,
    case .number(let trialDays)? = config["trialDays"]
{
    showTrial(days: Int(trialDays))
} else {
    showTrial(days: 7) // Safe default
}

Payloads are cached with the rest of the flag, so they stay available offline.

Identity behavior

Flag results are scoped to the current person. The SDK clears them after identify() or a reset, so one customer never sees another customer's assignment.

Choose a safe default to use while flags are loading or unavailable. Do not use a feature flag to gate paid access. Use entitlement grants for that instead.

PreviousIdentify customersNextCapture analytics

On this page

Evaluate flagsRead a variant's payloadIdentity behavior