<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macOS: 14.0.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/storeProductsTask(for:priority:action:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI",
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewP010_StoreKit_aB0E17storeProductsTask3for8priority6actionQrqd___ScPy0dE07ProductVADE010CollectionH5StateOYactSlRd__SQRd__s8SendableRd__SS7ElementSTRtd__lF"
  },
  "title" : "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.

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

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)