Skip to main content
Asynchronously queries whether a given entitlement type is currently active for the user. Use this to gate features or show conditional UI based on active entitlements. This method automatically performs a smart refresh to guarantee fresh entitlement data before returning the result.

Signature

public func isActive(
  _ type: Entitlement,
  in scope: EntitlementScope = .all
) async -> Bool

Parameters

NameTypeDescription
typeEntitlementThe entitlement type
scopeEntitlementScopeThe scope to check

Returns

Returns true if the specified entitlement is currently active for the user, false otherwise.

Usage

Task {
  let hasTrial = await Encore.shared.isActive(.freeTrial(), in: .all)
  
  if hasTrial {
    // User has an active free trial
    showPremiumFeatures()
  } else {
    // User doesn't have a free trial
    showUpgradePrompt()
  }
}
For reactive, real-time entitlement tracking in Combine-based apps, use isActivePublisher() instead.