<!--
{
  "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/dimensions(in:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI13LayoutSubviewV10dimensions2inAA14ViewDimensionsVAA08ProposedG4SizeV_tF"
  },
  "title" : "dimensions(in:)"
}
-->

# dimensions(in:)

Asks the subview for its dimensions and alignment guides.

```
func dimensions(in proposal: ProposedViewSize) -> ViewDimensions
```

## 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

A [`ViewDimensions`](/documentation/SwiftUI/ViewDimensions) instance that includes a height
and width, as well as a set of alignment guides.

## Discussion

Call this method to ask a subview of a custom [`Layout`](/documentation/SwiftUI/Layout) type
about its size and alignment properties. You can call it from
your implementation of any of that protocol’s methods, like
[`placeSubviews(in:proposal:subviews:cache:)`](/documentation/SwiftUI/Layout/placeSubviews(in:proposal:subviews:cache:)) or
[`sizeThatFits(proposal:subviews:cache:)`](/documentation/SwiftUI/Layout/sizeThatFits(proposal:subviews:cache:)), to get
information for your layout calculations.

When you call this method, you propose a size using the `proposal`
parameter. The subview can choose its own size, but might take the
proposal into account. You can call this method more than
once with different proposals to find out if the view is flexible.
For example, you can propose:

- [`zero`](/documentation/SwiftUI/ProposedViewSize/zero) to get the subview’s minimum size.
- [`infinity`](/documentation/SwiftUI/ProposedViewSize/infinity) to get the subview’s maximum size.
- [`unspecified`](/documentation/SwiftUI/ProposedViewSize/unspecified) to get the subview’s ideal size.

If you need only the view’s height and width, you can use the
[`sizeThatFits(_:)`](/documentation/SwiftUI/LayoutSubview/sizeThatFits(_:)) method instead.

---

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)