---
title: "textLayoutFragment(for:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/nstextlayoutmanager/textlayoutfragment(for:)-4dhrx"
---

# textLayoutFragment(for:)

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

## Declaration

```swift
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

Return Value An NSTextLayoutFragment.

## See Also

### Causing layout generation

- [textViewportLayoutController](uikit/nstextlayoutmanager/textviewportlayoutcontroller.md)
- [invalidateLayout(for:)](uikit/nstextlayoutmanager/invalidatelayout(for:).md)
- [textLayoutFragment(for:)](uikit/nstextlayoutmanager/textlayoutfragment(for:)-68dez.md)
- [ensureLayout(for:)](uikit/nstextlayoutmanager/ensurelayout(for:)-6ptsj.md)
- [ensureLayout(for:)](uikit/nstextlayoutmanager/ensurelayout(for:)-3duae.md)
- [enumerateTextLayoutFragments(from:options:using:)](uikit/nstextlayoutmanager/enumeratetextlayoutfragments(from:options:using:).md)
- [NSTextLayoutManager.SegmentType](uikit/nstextlayoutmanager/segmenttype.md)
- [NSTextLayoutManager.SegmentOptions](uikit/nstextlayoutmanager/segmentoptions.md)
