---
title: "sizeThatFits(_:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/layoutsubview/sizethatfits(_:)"
---

# sizeThatFits(_:)

Asks the subview for its size.

## Declaration

```swift
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

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

## Discussion

Discussion Use this method as a convenience to get the width and height properties of the ViewDimensions instance returned by the dimensions(in:) method, reported as a CGSize instance.

## See Also

### Getting subview characteristics

- [dimensions(in:)](swiftui/layoutsubview/dimensions(in:).md)
- [spacing](swiftui/layoutsubview/spacing.md)
- [priority](swiftui/layoutsubview/priority.md)
