Skip to main content

Purpose

Create and present Encore offers using a fluent API that fits naturally in SwiftUI and UIKit. Purchases run through the EncorePurchaseController you register at configure() time.

Signature

placement(_:) returns a builder. Configure it with the optional builder methods, then call show():
Encore.shared.placement(_:) and the static Encore.placement(_:) are equivalent; the static form forwards to the shared instance.

Methods

.presented means the interaction ran: the offer sheet, or on IAP-first variants the purchase sheet that stands in for it. headline(_:) and subheadline(_:) pass the full string through as-is; the SDK never composes copy out of a count. Priority is this override, then the copy Encore resolved for your app, then the shipped template default, and an empty string is ignored so it can’t blank the shipped copy. See Where the copy comes from.

Use cases

The raw values are the wire format the backend stores and that analytics splits the funnel on. The case names are the API surface; the raw values are the contract. .reduceChurn is the default surface for cancel flows and paywall declines. .rewardUsers presents the reward surface after the user has already done something worth celebrating (a completed purchase, a milestone, a streak); it is not a way to sell. It is claim-only: no in-app purchase runs anywhere in the path, and it never falls back to the paywall sheet. See Reward Users. If no enabled variant resolves for the requested use case, show() resolves with .notPresented(.useCaseUnavailable) and no UI appears.

Usage Patterns

The facade and builder are @MainActor, so call show() from a main-actor context: a SwiftUI button action, a .task, or a UIKit handler. A SwiftUI Button action is synchronous, so wrap the await in a Task:

Callback form

When the call site can’t await, show(resume:) delivers every outcome on the main actor:
There is no fire-and-forget show() in 2.x. Every presentation resolves exactly once, and the resolution is always delivered, so fallback logic can never be silently skipped.

Selecting a use case

show() is @MainActor: presentation always happens on the main thread. From nonisolated code, await hops to the main actor automatically and the result still resumes there.

Appearance

The sheet renders in light, dark, or automatic appearance, following the appearance mode configured for your app in the Encore dashboard. Automatic is the default: the presentation window is left unspecified, so the sheet inherits your app’s interface style and switches with it, with no work on your side.