---
title: "ensureLayout(forBoundingRect:in:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/nslayoutmanager/ensurelayout(forboundingrect:in:)"
---

# ensureLayout(forBoundingRect:in:)

Forces the layout manager to perform layout for the specified area in the specified text container if it hasn’t already.

## Declaration

```swift
func ensureLayout(forBoundingRect bounds: CGRect, in container: NSTextContainer)
```

## Parameters

- `bounds`: The area for which layout is performed.
- `container`: The text container containing the area for which layout is performed.

## Discussion

Discussion The layout manager reserves the right to perform layout for larger ranges. If noncontiguous layout is disabled, then the affected range is always effectively extended to start at the beginning of the text.

## See Also

### Causing glyph generation and layout

- [ensureGlyphs(forCharacterRange:)](uikit/nslayoutmanager/ensureglyphs(forcharacterrange:).md)
- [ensureGlyphs(forGlyphRange:)](uikit/nslayoutmanager/ensureglyphs(forglyphrange:).md)
- [ensureLayout(forCharacterRange:)](uikit/nslayoutmanager/ensurelayout(forcharacterrange:).md)
- [ensureLayout(forGlyphRange:)](uikit/nslayoutmanager/ensurelayout(forglyphrange:).md)
- [ensureLayout(for:)](uikit/nslayoutmanager/ensurelayout(for:).md)
- [glyphGenerator](appkit/nslayoutmanager/glyphgenerator.md)
