<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/LayoutSubview/sizeThatFits(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI13LayoutSubviewV12sizeThatFitsySo6CGSizeVAA16ProposedViewSizeVF"
  },
  "title" : "sizeThatFits(_:)"
}
-->

# sizeThatFits(_:)

Asks the subview for its size.

```
func sizeThatFits(_ proposal: ProposedViewSize) -> CGSize
```

## Parameters

`proposal`

A proposed size for the subview. In SwiftUI,
views choose their own size, but can take a size proposal from
their parent view into account when doing so.

## Return Value

The size that the subview chooses for itself, given the
proposal from its container view.

## Discussion

Use this method as a convenience to get the [`width`](/documentation/SwiftUI/ViewDimensions/width)
and [`height`](/documentation/SwiftUI/ViewDimensions/height) properties of the [`ViewDimensions`](/documentation/SwiftUI/ViewDimensions)
instance returned by the [`dimensions(in:)`](/documentation/SwiftUI/LayoutSubview/dimensions(in:)) method, reported as a
<doc://com.apple.documentation/documentation/CoreFoundation/CGSize>
instance.

---

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)