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

# textLayoutFragment(for:)

Returns the text layout fragment from the document at the specified location.

```
func textLayoutFragment(for location: any NSTextLocation) -> NSTextLayoutFragment?
```

## Parameters

`location`

The starting location.

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