<!--
{
  "availability" : [
    "macOS: 12.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTextLayoutManager/textLayoutFragment(for:)-4dhrx",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSTextLayoutManager(im)textLayoutFragmentForPosition:"
  },
  "title" : "textLayoutFragment(for:)"
}
-->

# textLayoutFragment(for:)

Returns the text layout fragment at the position you specify in the text container.

```
func textLayoutFragment(for position: CGPoint) -> NSTextLayoutFragment?
```

## Parameters

`position`

A <doc://com.apple.documentation/documentation/CoreFoundation/CGPoint> that describes the position in the coordinate system for the text container.

## Return Value

An [`NSTextLayoutFragment`](/documentation/AppKit/NSTextLayoutFragment).

---

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)