---
title: "replaceTextStorage(_:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nslayoutmanager/replacetextstorage(_:)"
---

# replaceTextStorage(_:)

Replaces the layout manager’s current text storage object with the specified object.

## Declaration

```swift
func replaceTextStorage(_ newTextStorage: NSTextStorage)
```

## Parameters

- `newTextStorage`: The text storage object to set.

## Discussion

Discussion Use this method to update the text storage uniformly for a group of related layout manager objects. Unlike changing the value in the textStorage property, this method replaces the text storage for all NSLayoutManager objects that share the current layout manager’s NSTextStorage object.

## See Also

### Accessing the text storage

- [textStorage](appkit/nslayoutmanager/textstorage.md)
