The current phase of the asynchronous loading operation of the promotional image for
a given App Store product.
When you create a ``ProductView`` instance with the phase-based
initializer, you define the appearance of the product view's icon using a
content closure. StoreKit calls the closure with a phase value at different points
during the load operation of the promoted IAP image you've set up in App Store Connect
to indicate the current state. Use the phase to decide what to draw. For example,
you can draw the loaded image if it exists, a view that indicates an error, or a
placeholder:
```
ProductView(id: "com.example.product") { phase in
switch phase {
case .success(let promotedIcon): promotedIcon
case .failure(let error): MyErrorView(error)
case .unavailable: MyFallbackIcon()
case .loading: MyPlaceholderIcon()
}
}
```
Members (2)
get · iOS 17.0+
promotionalIcon
TypeScript
get promotionalIcon(): (_SwiftUICore_Image) | null
Swift declaration
var promotionalIcon: Image? { get }
The promotional image if the loading task was successful.
Use this as a convenience to access the product value in code that doesn't depend on the reason
the icon can't be accessed. The value is `nil` while the icon is loading, or if the icon
can't be accessed for any reason.
get · iOS 17.0+
error
TypeScript
get error(): (NativeError) | null
Swift declaration
var error: (any Error)? { get }
The error if the loading task was unsuccessful.
Use this as a convenience to access the error value in code that assumes there has
been a promotional image set up for the product in App Store Connect. The value is `nil`
while the icon is loading, if the icon has successfully loaded, or if the promotional image
for the product has not been set up in App Store Connect.