<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/NSTextContainer/layoutManager",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSTextContainer(py)layoutManager"
  },
  "title" : "layoutManager"
}
-->

# layoutManager

The text container’s layout manager.

```
unowned(unsafe) var layoutManager: NSLayoutManager? { get set }
```

## Discussion

Avoid assigning a layout manager directly through this property. Instead, use the [`replaceLayoutManager(_:)`](/documentation/UIKit/NSTextContainer/replaceLayoutManager(_:)) method when you want to replace the layout manager. The framework sets the value of this property automatically when you add a text container to your layout manager using the [`addTextContainer(_:)`](/documentation/UIKit/NSLayoutManager/addTextContainer(_:)) method.

## See Also

[`func addTextContainer(NSTextContainer)`](/documentation/UIKit/NSLayoutManager/addTextContainer(_:))

Appends the specified text container to the series of text containers where the layout manager arranges 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)