Skip to main content
Monitor Encore entitlements in real-time to adapt your UI and user experience.

Overview

Encore tracks earned entitlements automatically, including free trials, discounts, and credits. You can check entitlement status anywhere in your app to display promotional badges, show reward status, or highlight temporary access periods.

Third-Party Paywall Integrations

For Superwall and RevenueCat integrations, see the dedicated guides:

Checking Entitlement Status

Async Boolean Check

Check if a user has an active promotional reward using the async isActive() method, which automatically performs a smart refresh to ensure fresh data:
import Encore

Task {
  // Check for any active trial
  let hasAnyTrial = await Encore.shared.isActive(.freeTrial(), in: .all) // default scope
  
  // Check for active free trial (verified only)
  let hasVerifiedTrial = await Encore.shared.isActive(.freeTrial(), in: .verified)
}
See the SDK Reference for complete API details: isActive.
// One-off combination example with async
Task {
  let hasEncoreTrial = await Encore.shared.isActive(.freeTrial())
  let hasProAccess = hasEncoreTrial || yourIAPManager.hasActiveSubscription
}
Encore manages its own entitlements. To incorporate Encore with your existing logic, simply OR Encore’s active status with your current subscription state.

Using Combine Publishers for Reactive Updates

For reactive apps that need to respond automatically to entitlement changes, subscribe using isActivePublisher():
import Combine
import Encore

class EntitlementManager: ObservableObject {
    @Published var hasActiveFreeTrial = false
    private var cancellables = Set<AnyCancellable>()
    
    init() {
        // Subscribe to promotional access changes - updates automatically
        Encore.shared.isActivePublisher(for: .freeTrial())
            .assign(to: \.hasActiveFreeTrial, on: self)
            .store(in: &cancellables)
    }
}
See the SDK Reference for complete API details: isActivePublisher.

Using with Your Entitlement Manager

The most common pattern is to integrate Encore entitlements with your existing subscription/entitlement manager. This keeps your access logic centralized and combines IAP subscriptions with Encore promotional rewards. Create a centralized manager that tracks both IAP subscriptions and Encore entitlements:
import Foundation
import Encore
import Combine

class EntitlementManager {
    @Published var hasProAccess: Bool = false
    private var cancellables = Set<AnyCancellable>()
    
    init() {
        // Combine IAP subscription status with Encore promotional rewards
        Publishers.CombineLatest(
            yourIAPManager.subscriptionStatusPublisher,
            Encore.shared.isActivePublisher(for: .freeTrial())
        )
        .map { iapActive, encoreActive in
            // User has pro access if EITHER they have an active IAP subscription
            // OR they have an active Encore promotional reward
            return iapActive || encoreActive
        }
        .assign(to: \.hasProAccess, on: self)
        .store(in: &cancellables)
    }
}
See the SDK Reference for complete API details: isActivePublisher.

Usage in SwiftUI

Once your entitlement manager is set up, use it throughout your app:
import SwiftUI

@main
struct YourApp: App {
    @StateObject private var entitlements = EntitlementManager()
    
    var body: some Scene {
        WindowGroup {
            ContentView()
                .environmentObject(entitlements)
        }
    }
}

struct ContentView: View {
    @EnvironmentObject var entitlements: EntitlementManager
    
    var body: some View {
        VStack {
            if entitlements.hasProAccess {
                // Show premium content
                PremiumContentView()
            } else {
                // Show paywall
                SubscriptionPaywallView()
            }
        }
    }
}

Next Steps