ProductView
A view that merchandises an individual In-App Purchase product.
Declaration
@MainActor @preconcurrency struct ProductView<Icon, PlaceholderIcon> where Icon : View, PlaceholderIcon : ViewOverview
A ProductView shows information about an in-app purchase product, including its localized name, description, and price, and displays a purchase button.
You create a product view by providing a product identifier to load from the App Store, or a Product value you previously loaded. If you provide a product identifier, the view loads the product’s information from the App Store automatically, and updates the view when the product is available.
You can customize the view by providing a view to use as an icon, or image, for the in-app purchase product. If you provide a product identifier, you can optionally provide a placeholder icon for the system to use instead of the automatic placeholder icon. If you set up promoted images for your products in App Store Connect, you can choose to use those images as the icon.
You can customize the product view’s appearance using the standard styles, including the CompactProductViewStyle, RegularProductViewStyle, and LargeProductViewStyle styles. Apply the style using the productViewStyle(_:) view modifier.
You can also create your own custom styles by creating styles that conform to the ProductViewStyle protocol.
Topics
Creating product views that load products
init(id:prefersPromotionalIcon:)init(id:prefersPromotionalIcon:icon:)init(id:prefersPromotionalIcon:icon:placeholderIcon:)init(id:icon:placeholderIcon:)