<!--
{
  "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/ProductView/init(id:icon:placeholderIcon:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "StoreKit",
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:17_StoreKit_SwiftUI11ProductViewV2id4icon15placeholderIconACyxq_GSS_xAA0eJ5PhaseOcq_yXEtcfc"
  },
  "title" : "init(id:icon:placeholderIcon:)"
}
-->

# init(id:icon:placeholderIcon:)

Creates a view to load an individual product from the App Store, and merchandise it using its promotional image and a custom placeholder icon.

```
nonisolated init(id productID: Product.ID, @ViewBuilder icon: @escaping (ProductIconPhase) -> Icon, @ViewBuilder placeholderIcon: () -> PlaceholderIcon)
```

## Parameters

`productID`

The product identifier to load from the App Store.

`icon`

A closure that receives a [`ProductIconPhase`](/documentation/StoreKit/ProductIconPhase) as an input, which indicates the state of the loading operation of the product’s promotional image, and returns the view to display for the specified phase.

`placeholderIcon`

A closure that returns an icon to display until the system finishes loading the product from the App Store.

## Discussion

The product view shows the `placeholderIcon` until the system finishes loading the product. After the product finishes loading, the view asynchronously loads and displays the product’s promotional image. Use the [`ProductIconPhase`](/documentation/StoreKit/ProductIconPhase) to monitor the current loading state of the product’s promotional image.

If the product is unavailable, the view displays the `placeholderIcon` as a fallback.

The [`ProductIconPhase`](/documentation/StoreKit/ProductIconPhase) value indicates whether the promotional image is loading, unavailable, or whether it succeeded or failed to load. Use the phase to decide what to draw. While the image’s loading operation is in the [`ProductIconPhase.loading`](/documentation/StoreKit/ProductIconPhase/loading) phase, consider displaying the same view that you provide in the `placeholderIcon` closure. For more information, see [`ProductIconPhase`](/documentation/StoreKit/ProductIconPhase).

---

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)