UITextView erroneously overrides string attributes when applying spellchecker annotation attributes.
It doesn't need any particular setting. Default UITextView instance with attributed text
let textView = UITextView(usingTextLayoutManager: true)
textView.spellCheckingType = .yes
Once spellcheck attributes get applied, other attributes like foregroundColor
gets applied to the mispelled words. This behavior happens only on Mac Catalyst, and started to appear on macOS 14 or newer.
Please find attached Xcode project that demonstrates the issue: https://github.com/user-attachments/files/16689336/TextEditor-FB14165227.zip
- Open TextEditor project
- Select "My Mac (Mac Catalyst)" build destination
- Run the project, a window with text area should appear
- Select the whole text (either using mouse or keyboard command+a)
- Observe how foregroundColor changes to text (this is the issue)
I recorded video with that, and attach to this report.
Screen.Recording.2024-07-02.at.12.40.06.mov