Skip to main content

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.

Returns a Combine publisher that emits changes to an entitlement’s active state. Use this for reactive UI updates in SwiftUI or when you need automatic notifications when entitlement status changes.

Signature

public func isActivePublisher(
  for type: Entitlement,
  in scope: EntitlementScope = .all
) -> AnyPublisher<Bool, Never>

Parameters

NameTypeDescription
typeEntitlementThe entitlement type to observe
scopeEntitlementScopeThe scope to check

Returns

AnyPublisher<Bool, Never> - A publisher that emits true when the entitlement becomes active and false when it becomes inactive.

Usage

// Automatically update when state changes
Encore.shared
  .isActivePublisher(for: .freeTrial(), in: .verified)
  .sink { isActive in
    // Called whenever the state changes
  }
  .store(in: &cancellables)