---
title: "storeProductsTask(for:priority:action:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/storeproductstask(for:priority:action:)"
---

# storeProductsTask(for:priority:action:)

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

## Declaration

```swift
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

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:)](swiftui/view/appstoreoverlay(ispresented:configuration:).md)
- [manageSubscriptionsSheet(isPresented:)](swiftui/view/managesubscriptionssheet(ispresented:).md)
- [refundRequestSheet(for:isPresented:onDismiss:)](swiftui/view/refundrequestsheet(for:ispresented:ondismiss:).md)
- [offerCodeRedemption(options:isPresented:onCompletion:)](swiftui/view/offercoderedemption(options:ispresented:oncompletion:).md)
- [musicPicker(isPresented:title:selection:)](swiftui/view/musicpicker(ispresented:title:selection:).md)
- [musicSubscriptionOffer(isPresented:options:onLoadCompletion:)](swiftui/view/musicsubscriptionoffer(ispresented:options:onloadcompletion:).md)
- [currentEntitlementTask(for:priority:action:)](swiftui/view/currententitlementtask(for:priority:action:).md)
- [inAppPurchaseOptions(_:)](swiftui/view/inapppurchaseoptions(_:).md)
- [manageSubscriptionsSheet(isPresented:subscriptionGroupID:)](swiftui/view/managesubscriptionssheet(ispresented:subscriptiongroupid:).md)
- [onInAppPurchaseCompletion(perform:)](swiftui/view/oninapppurchasecompletion(perform:).md)
- [onInAppPurchaseStart(perform:)](swiftui/view/oninapppurchasestart(perform:).md)
- [productIconBorder()](swiftui/view/producticonborder().md)
- [productViewStyle(_:)](swiftui/view/productviewstyle(_:).md)
- [productDescription(_:)](swiftui/view/productdescription(_:).md)
- [storeButton(_:for:)](swiftui/view/storebutton(_:for:).md)
