---
title: "replaceLayoutManager(_:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/nstextcontainer/replacelayoutmanager(_:)"
---

# replaceLayoutManager(_:)

Replaces the layout manager for the group of text system objects that contains the text container.

## Declaration

```swift
func replaceLayoutManager(_ newLayoutManager: NSLayoutManager)
```

## Parameters

- `newLayoutManager`: The new layout manager.

## Discussion

Discussion The framework reassigns all text containers and text views attached to the old layout manager to the new layout manager. Unlike setting the layoutManager property directly, this method makes all the adjustments necessary to keep the text object relationships intact.

## See Also

### Managing text components

- [layoutManager](uikit/nstextcontainer/layoutmanager.md)
- [textLayoutManager](uikit/nstextcontainer/textlayoutmanager.md)
- [textView](appkit/nstextcontainer/textview.md)
