<!--
{
  "availability" : [
    "iOS: 13.0.0 - 27.0.0",
    "iPadOS: 13.0.0 - 27.0.0",
    "macCatalyst: 13.0.0 - 27.0.0",
    "macOS: 10.15.0 - 27.0.0",
    "tvOS: 13.0.0 - 27.0.0",
    "visionOS: 1.0.0 - 27.0.0",
    "watchOS: 6.0.0 - 27.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/previewLayout(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE13previewLayoutyQr21DeveloperToolsSupport07PreviewE0OF"
  },
  "title" : "previewLayout(_:)"
}
-->

# previewLayout(_:)

Overrides the size of the container for the preview.

```
nonisolated func previewLayout(_ value: PreviewLayout) -> some View
```

## Parameters

`value`

A layout to use for preview.

## Return Value

A preview that uses the given layout.

## Discussion

By default, previews use the `PreviewLayout/device` layout,
which places the view inside a visual representation of the chosen
device. You can instead tell a preview to use a different layout
by choosing one of the `PreviewLayout` values, like
`PreviewLayout/sizeThatFits`:

```
struct CircleImage_Previews: PreviewProvider {
    static var previews: some View {
        CircleImage()
            .previewLayout(.sizeThatFits)
    }
}
```

---

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)