---
title: "pasteAsRichText(_:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nstextview/pasteasrichtext(_:)"
---

# pasteAsRichText(_:)

This action method inserts the contents of the pasteboard into the receiver’s text as rich text, maintaining its attributes.

## Declaration

```swift
func pasteAsRichText(_ sender: Any?)
```

## Parameters

- `sender`: The control that sent the message; may be nil.

## Discussion

Discussion The text is inserted at the insertion point if there is one, otherwise replacing the selection.

## See Also

### Related Documentation

- [insertText(_:)](appkit/nstextview/inserttext(_:).md)

### Clicking and pasting

- [clicked(onLink:at:)](appkit/nstextview/clicked(onlink:at:).md)
- [pasteAsPlainText(_:)](appkit/nstextview/pasteasplaintext(_:).md)
