Contents

subscriptionStatusTask(for:priority:action:)

Declares the view as dependent on the status of an auto-renewable subscription group, and returns a modified view.

Declaration

nonisolated func subscriptionStatusTask(for groupID: String, priority: TaskPriority = .medium, action: @escaping (EntitlementTaskState<[Product.SubscriptionInfo.Status]>) async -> ()) -> some View

Parameters

  • groupID:

    The subscription group ID to get the status for. The task restarts whenever this parameter changes.

  • priority:

    The task priority to use when creating the task.

  • action:

    The action to perform when the task’s state changes.

Discussion

Before a view modified with this method appears, a task will start in the background to get the subscription status. While the view is presented, the task will call action whenever the status changes or the task’s state changes.

See Also

Interacting with the App Store and Apple Music