AppDelegate or SwiftUI App initializer, before using any other SDK methods.
Call
configure() before using any other SDK methods. Failure to do so will result in .notInitialized errors.Signature
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
apiKey | String | - | Your Public API Key or Universal Sandbox Key from the Encore Dashboard settings |
logLevel | EncoreLogLevel? | .none | Debug logging level |
Log levels
API keys
Encore supports two types of API keys:| Key Type | Format | Description |
|---|---|---|
| Public API Key | enc_pub... | Production key with standard geo-filtering based on offers’ configured regions |
| Universal Sandbox Key | enc_pub_sandbox... | Testing key that bypasses geo-filtering, allowing you to test the complete entitlement lifecycle from any location |
Use the universal sandbox key (
enc_pub_sandbox...) during development to test offers from any location without geo-filtering restrictions. This makes it easy to test the entire entitlement lifecycle end-to-end for a single user.Always use your production API key (
enc_pub...) in production builds. The sandbox key is for development and testing only.Usage
Basic Configuration
SwiftUI
With Debug Logging (Development)
Using Universal Sandbox Key for Testing
Use the universal sandbox key to test offers from any location without geo-filtering:The universal sandbox key (
sb_...) is perfect for comprehensive end-to-end testing of the entitlement lifecycle, allowing you to test location-restricted offers from anywhere during development.Use
logLevel: .debug during development to see detailed SDK logs, then remove it (or use .none) for production builds.