<!--
{
  "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" : "StoreKit",
  "identifier" : "/documentation/StoreKit/StoreView/init(ids:prefersPromotionalIcon:icon:placeholderIcon:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "StoreKit",
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:17_StoreKit_SwiftUI0A4ViewV3ids22prefersPromotionalIcon4icon011placeholderI0ACyxq_Gqd___Sbx0aB07ProductVcq_yXEtcSlRd__SS7ElementRtd__lufc"
  },
  "title" : "init(ids:prefersPromotionalIcon:icon:placeholderIcon:)"
}
-->

# init(ids:prefersPromotionalIcon:icon:placeholderIcon:)

Creates a view to load a collection of products from the App Store using product identifiers, and merchandise them using an image and a custom placeholder icon.

```
nonisolated init(ids productIDs: some Collection<String>, prefersPromotionalIcon: Bool = false, @ViewBuilder icon: @escaping (Product) -> Icon, @ViewBuilder placeholderIcon: () -> PlaceholderIcon)
```

## Parameters

`productIDs`

The product identifiers to load from the App Store.

`prefersPromotionalIcon`

A Boolean value that indicates whether to use a promotional image from the App Store, if it’s available. If this parameter is `false`, the system ignores promotional images.

`icon`

A closure that returns the image the view displays when the products finish loading from the App Store.

`placeholderIcon`

A closure that returns the image that the view uses while the products are loading. The view uses the same placeholder image for all the products.

## Discussion

The store view shows the custom placeholder icon until all products finish loading. After the view finishes loading the products, it uses the image you provide, by default. If you set `prefersPromotionalIcon` to `true`, any products that have an available promotional image use the promotional image instead.

The following example shows how to create a store view using an icon and a custom placeholder icon:

```swift
StoreView(ids: [
    "com.example.product1",
    "com.example.product2"
]) { product in
     Image(systemName: "star.fill")
         .foregroundStyle(.yellow)
 } placeholderIcon: {
      Image(systemName: "star.fill")
         .foregroundStyle(.gray)
 }
```

---

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)