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

# init(_:prefersPromotionalIcon:icon:)

Creates a view to merchandise an individual product using a custom icon.

```
nonisolated init(_ product: Product, prefersPromotionalIcon: Bool = false, @ViewBuilder icon: () -> Icon) where PlaceholderIcon == EmptyView
```

## Parameters

`product`

The product to merchandise.

`prefersPromotionalIcon`

A Boolean value that indicates whether to use the promotional image from the App Store, if it’s available. If this value is `true` and a promotional image for the product is available, the view displays it instead of the view you provide in the `icon` parameter.

`icon`

A closure that returns the image to use for decorating the Apple In-App Purchase product.

## Discussion

If `prefersPromotionalIcon` is `true` and the product has a promotional image, the view displays the promotional image instead of the view you provide in `icon`.

The following example shows how to create a product view using a custom icon:

```swift
ProductView(product) {
    Image(systemName: "star.fill")
        .foregroundStyle(.yellow)
}
```

> Tip:
> To gain more control over the image that decorates this view, use the ``doc://com.apple.storekit/documentation/StoreKit/ProductView/init(_:icon:)`` initializer. It receives a ``doc://com.apple.storekit/documentation/StoreKit/ProductIconPhase``, which enables you to supply an image for each phase of the image-loading process.

---

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)