A lightweight, non-invasive SDK for presenting targeted retention offers and managing promotional entitlements in iOS apps.
Encore helps you reduce churn by presenting personalized retention offers (free trials, discounts, credits) at critical moments like cancellation flows or feature paywalls. The SDK provides:
- ✅ SwiftUI-native presentation methods
- ✅ Automatic user ID generation - zero boilerplate
- ✅ Real-time entitlement tracking with Combine publishers
- ✅ Type-safe attributes for personalized targeting
- ✅ Crash-safe design - SDK errors never crash your app
- ✅ Robust error handling with comprehensive error types
Tell Encore where a gift button and a claim reminder sit; Encore decides the look, what happens after a claim, and counts views and taps.
import Encore
Encore.shared.identify(userId: user.uid)
GiftsButton(placement: "talk_milestone")
ClaimReminder(placement: "discover_reminder")
.headline("60 min talking today!")- Text:
.headline(_:),.subheadline(_:)and.cta(_:)set your own copy over the look's (UIKit: theheadline,subheadlineandctaproperties). A blank value keeps the look's text. - Sheet text:
.sheetHeadline(_:)and.sheetSubheadline(_:)set the headline and subheadline of the sheet a tap opens (UIKit andEncoreClaim: thesheetHeadlineandsheetSubheadlineproperties;Encore.claim(...)takes both too)..headline(_:)styles only the component and never reaches the sheet. - Colours: pass
appearance:to style the component; the sheet it opens takes only itsaccentColorand that accent'sonAccentColor. - Width: a look keeps its design width on wide screens, centred;
alignment:moves it to the leading or trailing edge, in your app's layout direction. - Opening by itself: Encore may test a look that opens the sheet once by itself. Pass
autoOpen: .offto forbid it. - Your app's state:
GiftsButton(...).hostState(.locked(progress: 0.5))keeps a gift locked until something in your app happens: a tap opens nothing and the look hints. Pass steps instead with.locked(completed: 3, of: 4). Switch to.ready(then.done) to let it open (UIKit: thehostStateproperty). It is in no request; events carry its status, never the progress. - When it draws nothing:
.onShowingChange { showing in ... }tells you whether a look is drawn, so you can draw your own view in its place (UIKit: theonShowingChangeproperty).
When the components don't fit your design, draw your own and let Encore drive it:
@StateObject private var claim = Encore.claim(placement: "streak")
var body: some View {
switch claim.state {
case .gifts(let gifts), .thanks(let gifts): MyGiftButton(count: gifts.offerCount).encoreClaim(claim)
case .reminder(let reminder): MyReminder(reminder).encoreClaim(claim)
case .hidden: EmptyView()
}
}What it shows after a claim or a completion is set by Encore per placement, like a look. UIKit
views attach with let unbind = claim.bind(view) (call unbind() when the view goes).
Only need to show or hide one entry? Put the placement on it. Encore draws it only while there is
something to open, takes the tap, and the entry takes no space otherwise. Use a plain view, not a
Button: a control with its own tap action competes with the modifier for the tap.
MyGiftRow().encoreClaim(placement: "streak")Opening the sheet from your own flow instead (the end of a level, a menu item)? Ask once, as you decide:
let reward = Encore.placement("level_end").useCase(.rewardUsers)
if await reward.hasOffers() { await reward.show() }A button that stays on screen should use Encore.claim: it checks again when the app returns to the
foreground or the user's attributes change, and a tap on expired offers checks before it opens.
hasOffers() on a placement answers once.
The SDK ships PrivacyInfo.xcprivacy in every distribution (SwiftPM, XCFramework, CocoaPods).
Xcode folds it into your app's privacy report when you archive.
The manifest lists what the SDK can collect. Your App Store label only needs what your integration actually sends. Out of the box that is a random per-install identifier, offer and app-lifecycle events, and purchase links. Everything else arrives only when you pass it.
| If your integration | Declare |
|---|---|
| Any use of the SDK | Identifiers > Device ID; Usage Data > Product Interaction; Usage Data > Advertising Data |
Leaves transactionLinking on (default) |
Purchases > Purchase History |
Calls identify() / setUserAttributes() |
Identifiers > User ID, plus the attribute types you pass (email, name, phone, address, location, age) |
Data the SDK collects on its own is declared not linked to the user: it carries a random
per-install identifier and, when transactionLinking is on, Apple's app-account identifier,
neither of which tells us anything about the person. Data you pass through identify() is
declared linked, because you supplied the identity. Offer surfaces and the attributes used to
pick offers also carry Apple's Third-Party Advertising purpose, since the offers come from
third-party brands. That purpose is not tracking: see below.
Four things worth knowing before you fill the label in:
transactionLinking: falsestops the StoreKit history scan, the transaction-chain uploads, and the read of Apple's app transaction id: no copy is stored, and events carry noapp_account_id. NCL cohorts then hash the user id. While it is on, the linked purchases include purchases made outside Encore (organic, renewals, restores), because lift measurement needs the control group. With the flag off and no Encore IAP offers, omit Purchase History from your label. If you run Encore IAP offers through your purchase controller, the funnel events still carry the product id and its listed price.reset()clears the user id, attributes and cached entitlements on device. When linking is on, it does not clear Apple's app transaction identifier, which is Apple-Account-scoped and survives reinstall by design.UserAttributes.ageis whole years, 0 to 120; any other value is dropped with a warning. If you hold only a range, pass its lowest end (13-17is 13).dateOfBirthis kept on the device and sent only as the whole-year age it gives that day, the lower one ifageis set too.UserAttributes.customis free-form, so the SDK cannot classify it. Whatever you put there, declare under the matching Apple data type.- Nothing is used for tracking.
NSPrivacyTrackingisfalse, there are no tracking domains, and the SDK never reads the advertising identifier, so no ATT prompt is required.
The SDK's only required-reason API is UserDefaults (reason CA92.1, its own container).
- Documentation: docs.encore.com/ios
- Email: sdk-bot@encorekit.com