Documentation Index
Fetch the complete documentation index at: https://docs.encorekit.com/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Encore.shared.show() returns a PresentationResult. You can either branch on the returned value at the call site (async-result) or register global onPurchaseRequest / onPassthrough handlers (handler-based). Both work; pick whichever fits the call site.
For the cross-platform decision tree, see Integration Patterns.
Async-result pattern
Use this when the place you callshow() from already has access to your purchase + decline logic.
Basic example
From SwiftUI
Button action bodies are synchronous, so wrap in Task:
Result type
Handler pattern
Use this when theshow() call site is a third-party delegate (Superwall, RevenueCat) or a UI action that doesn’t have direct access to your purchase code.
Register at app launch
Then show() from anywhere
show() is ignored — control flow lives in the handlers.
When to use which
- Async-result — call site already imports your billing client. Branch-specific code lives at the call site.
- Handler — Encore is invoked from third-party paywall delegates (Superwall, RevenueCat) or from many UI sites that share post-purchase logic.
- Mixed — register a handler for cross-cutting analytics, and still branch on
await show()for site-specific UI navigation.
Re-registration semantics
removeHandler API.
Platform-specific notes
Task { }wrapping —show()isasync throws; SwiftUIButtonactions and UIKit@IBActionselectors are synchronous, so wrap the call inTask { ... }.PresentationResultis non-throwing in the success path —try await show()only throws on transport / SDK errors. The “user dismissed” case is.notGranted(...), not a thrown error.Encoretypealias —Encoreis a typealias forEncoreClient. UseEncoreeverywhere; the alias exists for SDK internal reasons (Swift module/type collision workaround).- Handler signature —
onPurchaseRequest’s closure isasync-friendly; you canawaitdirectly inside it without a manualTask.
See also
- Concepts — Integration Patterns — cross-platform decision tree
- Quickstart — Present Offers — handler-pattern walkthrough
- Using Superwall — handler pattern from a Superwall delegate
- Using RevenueCat — handler pattern alongside RevenueCat paywalls
- SDK Reference —
placement() - SDK Reference —
PresentationResult