Contents

storeProductTask(for:priority:action:)

Declares the view as dependent on an In-App Purchase product and returns a modified view.

Declaration

nonisolated func storeProductTask(for id: Product.ID, priority: TaskPriority = .medium, action: @escaping (Product.TaskState) async -> ()) -> some View

Parameters

  • id:

    The product ID to load from the App Store. 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 load the product from the App Store. While the view is presented, the task will call action whenever the product changes or the task’s state changes.

See Also

Interacting with the App Store and Apple Music