<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: 17.0.0 -",
    "macOS: 14.0.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "DeveloperToolsSupport",
  "identifier" : "/documentation/DeveloperToolsSupport/PreviewTrait/sizeThatFitsLayout",
  "metadataVersion" : "0.1.0",
  "role" : "Type Property",
  "symbol" : {
    "kind" : "Type Property",
    "modules" : [
      "DeveloperToolsSupport"
    ],
    "preciseIdentifier" : "s:21DeveloperToolsSupport12PreviewTraitVA2A0D0V10ViewTraitsORszlE18sizeThatFitsLayoutACyAGGvpZ"
  },
  "title" : "sizeThatFitsLayout"
}
-->

# sizeThatFitsLayout

Fit the container to the size of the preview when offered the size of
the device that the preview is running on.

```
@MainActor static var sizeThatFitsLayout: PreviewTrait<Preview.ViewTraits> { get }
```

## Discussion

This is the same as [`PreviewLayout.sizeThatFits`](/documentation/DeveloperToolsSupport/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)