init(_:icon:)
Creates a view to display a product that the system already loaded from the App Store, and merchandise it using its promotional image.
Declaration
nonisolated init(_ product: Product, @ViewBuilder icon: @escaping (ProductIconPhase) -> Icon) where PlaceholderIcon == EmptyViewParameters
- product:
The product to merchandise.
- icon:
A closure that receives a Producticonphase as an input, which indicates the state of the loading operation of the product’s promoted image, and returns the view to display for the specified phase.
Discussion
The product view asynchronously loads and displays the product’s promotional image.
The ProductIconPhase value indicates whether the promotional image is loading, unavailable, or whether it succeeded or failed to load. Use the ProductIconPhase to monitor current loading phase, and to decide the image to return in the icon closure.