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
appStoreOverlay(isPresented:configuration:)manageSubscriptionsSheet(isPresented:)refundRequestSheet(for:isPresented:onDismiss:)offerCodeRedemption(isPresented:onCompletion:)musicSubscriptionOffer(isPresented:options:onLoadCompletion:)currentEntitlementTask(for:priority:action:)inAppPurchaseOptions(_:)manageSubscriptionsSheet(isPresented:subscriptionGroupID:)onInAppPurchaseCompletion(perform:)onInAppPurchaseStart(perform:)productIconBorder()productViewStyle(_:)productDescription(_:)storeButton(_:for:)storeProductTask(for:priority:action:)