<!--
{
  "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",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI13LayoutSubviewV"
  },
  "title" : "LayoutSubview"
}
-->

# LayoutSubview

A proxy that represents one subview of a layout.

```
struct LayoutSubview
```

## Overview

This type acts as a proxy for a view that your custom layout container
places in the user interface. [`Layout`](/documentation/SwiftUI/Layout) protocol methods
receive a [`LayoutSubviews`](/documentation/SwiftUI/LayoutSubviews) collection that contains exactly one
proxy for each of the subviews arranged by your container.

Use a proxy to get information about the associated subview, like its
dimensions, layout priority, or custom layout values. You also use the
proxy to tell its corresponding subview where to appear by calling the
proxy’s [`place(at:anchor:proposal:)`](/documentation/SwiftUI/LayoutSubview/place(at:anchor:proposal:)) method.
Do this once for each subview from your implementation of the layout’s
[`placeSubviews(in:proposal:subviews:cache:)`](/documentation/SwiftUI/Layout/placeSubviews(in:proposal:subviews:cache:)) method.

You can read custom layout values associated with a subview
by using the property’s key as an index on the subview. For more
information about defining, setting, and reading custom values,
see [`LayoutValueKey`](/documentation/SwiftUI/LayoutValueKey).

## Topics

### Placing the subview

[`place(at:anchor:proposal:)`](/documentation/SwiftUI/LayoutSubview/place(at:anchor:proposal:))

Assigns a position and proposed size to the subview.

### Getting subview characteristics

[`dimensions(in:)`](/documentation/SwiftUI/LayoutSubview/dimensions(in:))

Asks the subview for its dimensions and alignment guides.

[`sizeThatFits(_:)`](/documentation/SwiftUI/LayoutSubview/sizeThatFits(_:))

Asks the subview for its size.

[`spacing`](/documentation/SwiftUI/LayoutSubview/spacing)

The subviews’s preferred spacing values.

[`priority`](/documentation/SwiftUI/LayoutSubview/priority)

The layout priority of the subview.

### Getting custom values

[`subscript(_:)`](/documentation/SwiftUI/LayoutSubview/subscript(_:))

Gets the value for the subview that’s associated with the specified key.

## Relationships

### Conforms To

[`Equatable`](/documentation/Swift/Equatable)

---

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)