<!--
{
  "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" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/Text/LayoutKey/AnchoredLayout",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4TextV9LayoutKeyV08AnchoredD0V"
  },
  "title" : "Text.LayoutKey.AnchoredLayout"
}
-->

# Text.LayoutKey.AnchoredLayout

The layout of one text view, together with an anchor for the
position of that view.

```
struct AnchoredLayout
```

## Overview

[`Text.LayoutKey`](/documentation/SwiftUI/Text/LayoutKey) collects one of these values for every text view
in the subtree you query. Read [`layout`](/documentation/SwiftUI/Text/LayoutKey/AnchoredLayout/layout) to inspect the lines,
runs, and glyphs the text produced, and resolve [`origin`](/documentation/SwiftUI/Text/LayoutKey/AnchoredLayout/origin) in a
[`GeometryProxy`](/documentation/SwiftUI/GeometryProxy) to place something of your own next to the text:

```
ZStack {
    Text("Hello, world")
}
.overlayPreferenceValue(Text.LayoutKey.self) { layouts in
    GeometryReader { proxy in
        ForEach(0..<layouts.count, id: \.self) { index in
            Underline(layout: layouts[index].layout)
                .position(proxy[layouts[index].origin])
        }
    }
}
```

The anchor matters because a text view reports its layout in its own
coordinate space. Resolving the anchor converts that origin into the
space of the view reading the preference.

## Topics

### Instance Properties

[`var layout: Text.Layout`](/documentation/SwiftUI/Text/LayoutKey/AnchoredLayout/layout)

The text layout value.

[`var origin: Anchor<CGPoint>`](/documentation/SwiftUI/Text/LayoutKey/AnchoredLayout/origin)

The origin of the text layout.

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