Skip to main content
Install the ZEN Engine and evaluate your first decision in iOS.

Installation

Or in Xcode: File → Add Package Dependencies → Enter the repository URL.

Basic usage

Loader

The loader pattern enables dynamic decision loading from any storage backend. Implement the ZenDecisionLoaderCallback protocol with a func load(key: String) async throws -> Data? method. Use a thread-safe cache for optimal performance.

Bundle

Documents directory

Firebase Remote Config

Remote URL with caching

Remote URL with zip

Firebase Storage with zip

Async/Await

Evaluation functions are async, integrating natively with Swift concurrency:

Error handling

Tracing

Enable tracing to inspect decision execution:

Expression utilities

Evaluate ZEN expressions outside of a decision context:

Best practices

Initialize the engine once. Create a single ZenEngine instance at application startup and reuse it for all evaluations.
Cache decisions persistently. Use the Caches or Documents directory to cache downloaded decisions for offline use. Evaluate off the main thread. Use Task or Task.detached to avoid blocking the main thread during evaluation. Bundle fallback decisions. Include decisions in your app bundle as fallback for first launch or network failures.