<!--
{
  "availability" : [
    "macOS: 10.7.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSLayoutManager/ensureLayout(forBoundingRect:in:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSLayoutManager(im)ensureLayoutForBoundingRect:inTextContainer:"
  },
  "title" : "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.

```
func ensureLayout(forBoundingRect bounds: NSRect, 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

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.

---

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)