<!--
{
  "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/fixedLayout(width:height:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "DeveloperToolsSupport"
    ],
    "preciseIdentifier" : "s:21DeveloperToolsSupport12PreviewTraitVA2A0D0V10ViewTraitsORszlE11fixedLayout5width6heightACyAGG14CoreFoundation7CGFloatV_ANtFZ"
  },
  "title" : "fixedLayout(width:height:)"
}
-->

# fixedLayout(width:height:)

Center the preview in a fixed size container with the given dimensions.

```
@MainActor static func fixedLayout(width: CGFloat, height: CGFloat) -> PreviewTrait<T>
```

## Discussion

This is the same as [`PreviewLayout.fixed(width:height:)`](/documentation/DeveloperToolsSupport/PreviewLayout/fixed(width:height:)).

---

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)