---
title: "textView(_:shouldChangeTypingAttributes:toAttributes:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nstextviewdelegate/textview(_:shouldchangetypingattributes:toattributes:)"
---

# textView(_:shouldChangeTypingAttributes:toAttributes:)

Sent when the typing attributes are changed.

## Declaration

```swift
@MainActor optional func textView(_ textView: NSTextView, shouldChangeTypingAttributes oldTypingAttributes: [String : Any] = [:], toAttributes newTypingAttributes: [NSAttributedString.Key : Any] = [:]) -> [NSAttributedString.Key : Any]
```

## Parameters

- `textView`: The text view sending the message.
- `oldTypingAttributes`: The old typing attributes.
- `newTypingAttributes`: The proposed typing attributes.

## Return Value

Return Value The actual new typing attributes.

## See Also

### Setting Text Attributes

- [textView(_:shouldChangeTextIn:replacementString:)](appkit/nstextviewdelegate/textview(_:shouldchangetextin:replacementstring:).md)
- [textView(_:shouldChangeTextInRanges:replacementStrings:)](appkit/nstextviewdelegate/textview(_:shouldchangetextinranges:replacementstrings:).md)
- [textViewDidChangeTypingAttributes(_:)](appkit/nstextviewdelegate/textviewdidchangetypingattributes(_:).md)
