---
title: attributedString()
framework: appkit
role: symbol
role_heading: Instance Method
path: appkit/nstextinputclient/attributedstring()
---

# attributedString()

Returns an attributed string representing the receiver’s text storage.

## Declaration

```swift
optional func attributedString() -> NSAttributedString
```

## Return Value

Return Value The attributed string of the receiver’s text storage.

## Discussion

Discussion Implementation of this method is optional. A class adopting the NSTextInputClient protocol can implement this interface if it can be done efficiently to enable callers of this interface to access arbitrary portions of the receiver’s content more efficiently.

## See Also

### Storing text

- [attributedSubstring(forProposedRange:actualRange:)](appkit/nstextinputclient/attributedsubstring(forproposedrange:actualrange:).md)
- [insertText(_:replacementRange:)](appkit/nstextinputclient/inserttext(_:replacementrange:).md)
