<!--
{
  "availability" : [
    "macOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSLayoutManagerDelegate/layoutManager(_:didCompleteLayoutFor:atEnd:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSLayoutManagerDelegate(im)layoutManager:didCompleteLayoutForTextContainer:atEnd:"
  },
  "title" : "layoutManager(_:didCompleteLayoutFor:atEnd:)"
}
-->

# layoutManager(_:didCompleteLayoutFor:atEnd:)

Informs the delegate when the layout manager finishes laying out text in the specified text container.

```
optional func layoutManager(_ layoutManager: NSLayoutManager, didCompleteLayoutFor textContainer: NSTextContainer?, atEnd layoutFinishedFlag: Bool)
```

## Parameters

`layoutManager`

The layout manager doing the layout.

`textContainer`

The text container in which layout is complete. If `nil`, if there aren’t enough containers to hold all the text; the delegate can use this information as a cue to add another text container.

`layoutFinishedFlag`

If <doc://com.apple.documentation/documentation/Swift/true>, `aLayoutManager` is finished laying out its text—this also means that `aTextContainer` is the final text container used by the layout manager. Delegates can use this information to show an indicator or background or to enable or disable a button that forces immediate layout of text.

## Discussion

This message is sent whenever a text container has been filled. This method can be useful for paginating.

---

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)