---
title: "ensureLayout(for:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nstextlayoutmanager/ensurelayout(for:)-3duae"
---

# ensureLayout(for:)

Performs the layout for specified text range.

## Declaration

```swift
func ensureLayout(for range: NSTextRange)
```

## Parameters

- `range`: The doc://com.apple.appkit/documentation/AppKit/NSTextRange that describes the content to lay out.

## See Also

### Causing layout generation

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