experiment(_:) never returns nil. When the customer is not in the experiment, isEnrolled is false, variantKey is nil, and every typed getter (boolValue, stringValue, intValue, doubleValue with a default:, and ["key"] for JSON payloads) returns your default — so control renders with no extra branch. The raw optional assignment is experiment(_:).assignment (or getExperimentAssignment(experimentKey:)).
Use assignments for host-app decisions like:
- which paywall variant to render
- which offer emphasis to show
- which onboarding route to take
- whether a user belongs in a holdout group
Assignment and identity
Assignments are tied to customer context. Identity changes, logout, reset, and entitlement changes can affect what you should keep in local UI state. When identity changes, re-resolve assignment before rendering a purchase-critical screen.Safe implementation pattern
- Configure AppActor.
- Fetch offerings or Remote Config if the paywall needs them.
- Resolve the experiment assignment for the current placement.
- Render the variant in your own UI.
- Gate access from entitlements after purchase.
Launch Experiments
Read the product-level experiment launch checklist.