Skip to content

Instantly share code, notes, and snippets.

@krzyzanowskim
Last active October 2, 2024 11:29
Show Gist options
  • Save krzyzanowskim/2743af6ab859e7486813b5d285663379 to your computer and use it in GitHub Desktop.
Save krzyzanowskim/2743af6ab859e7486813b5d285663379 to your computer and use it in GitHub Desktop.
FB14165227: UlTextView erroneously overrides string attributes when applying spellchecker annotation attributes

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

  1. Open TextEditor project
  2. Select "My Mac (Mac Catalyst)" build destination
  3. Run the project, a window with text area should appear
  4. Select the whole text (either using mouse or keyboard command+a)
  5. Observe how foregroundColor changes to text (this is the issue)

I recorded video with that, and attach to this report.

@krzyzanowskim
Copy link
Author

Screen.Recording.2024-07-02.at.12.40.06.mov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment