Contents

storeProductsTask(for:priority:action:)

Declares the view as dependent on a collection of In-App Purchase products and returns a modified view.

Declaration

nonisolated func storeProductsTask(for ids: some Collection<String> & Equatable & Sendable, priority: TaskPriority = .medium, action: @escaping (Product.CollectionTaskState) async -> ()) -> some View

Parameters

  • ids:

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

See Also

Interacting with the App Store and Apple Music