<!--
{
  "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/ProductViewStyle",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "StoreKit",
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:17_StoreKit_SwiftUI16ProductViewStyleP"
  },
  "title" : "ProductViewStyle"
}
-->

# ProductViewStyle

A type that specifies the appearance and interaction of Apple In-App Purchase products within the view hierarchy.

```
@MainActor @preconcurrency protocol ProductViewStyle
```

## Overview

To configure the Apple In-App Purchase product style for a view hierarchy, use the <doc://com.apple.documentation/documentation/SwiftUI/View/productViewStyle(_:)> modifier.

To create a custom style, declare a type that conforms to the `ProductViewStyle` protocol. Implement the [`makeBody(configuration:)`](/documentation/StoreKit/ProductViewStyle/makeBody(configuration:)) method to return a view that composes the elements of the configuration that the system provides to your method. The following code example shows how to create a custom product view style:

```swift
struct CustomProductViewStyle: ProductViewStyle {
    func makeBody(configuration: Configuration) -> some View {
        switch configuration.state {
        // Add other cases here.
        case .success(let product):
            VStack(alignment: .center) {
                configuration.icon
                Text(product.displayName)
                Button(product.displayPrice) {}
            }
        }
    }
}

ProductView(id: "com.example.product")
    .productViewStyle(CustomProductViewStyle())
    // Add your code here.
```

## Topics

### Getting built-in product view styles

[`static var automatic: AutomaticProductViewStyle`](/documentation/StoreKit/ProductViewStyle/automatic)

[`static var compact: CompactProductViewStyle`](/documentation/StoreKit/ProductViewStyle/compact)

An product view style suitable for layouts where less space is available, or for displaying more items in a small amount of space.

[`static var large: LargeProductViewStyle`](/documentation/StoreKit/ProductViewStyle/large)

A product view style suitable for layouts where the Apple In-App Purchase content is prominent.

[`static var regular: RegularProductViewStyle`](/documentation/StoreKit/ProductViewStyle/regular)

A product view style that uses a standard, platform-appropriate layout.

### Creating custom product views

[`func makeBody(configuration: Self.Configuration) -> Self.Body`](/documentation/StoreKit/ProductViewStyle/makeBody(configuration:))

Creates a view that represents the body of a product view.

[`typealias Configuration`](/documentation/StoreKit/ProductViewStyle/Configuration)

A type that represents the properties of a product view style.

[`associatedtype Body : View`](/documentation/StoreKit/ProductViewStyle/Body)

A view that represents the body of a product view.

### Supporting types

[`struct AutomaticProductViewStyle`](/documentation/StoreKit/AutomaticProductViewStyle)

[`struct CompactProductViewStyle`](/documentation/StoreKit/CompactProductViewStyle)

A style for a product view that’s suitable for layouts with less available space, or for displaying more items in a small amount of space.

[`struct RegularProductViewStyle`](/documentation/StoreKit/RegularProductViewStyle)

A style for a product view that uses a standard, platform-appropriate layout.

[`struct LargeProductViewStyle`](/documentation/StoreKit/LargeProductViewStyle)

A style for a product view that’s suitable for layouts where the Apple In-App Purchase content is prominent.

## Relationships

### Conforming Types

[`LargeProductViewStyle`](/documentation/StoreKit/LargeProductViewStyle)

[`CompactProductViewStyle`](/documentation/StoreKit/CompactProductViewStyle)

[`AutomaticProductViewStyle`](/documentation/StoreKit/AutomaticProductViewStyle)

[`RegularProductViewStyle`](/documentation/StoreKit/RegularProductViewStyle)

---

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)