<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTextView/pasteAsRichText(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSTextView(im)pasteAsRichText:"
  },
  "title" : "pasteAsRichText(_:)"
}
-->

# pasteAsRichText(_:)

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

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

## Parameters

`sender`

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

## Discussion

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

## See Also

[`insertText(_:)`](/documentation/AppKit/NSTextView/insertText(_:))

Inserts `aString` into the receiver’s text at the insertion point if there is one, otherwise replacing the selection.



---

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)