Mac Catalyst - can't override highlight color in UITextField

I want to override the highlight color for text in UITextFields (for a Mac Catalyst app) so that I can't actually see it. I've tried setting the tintColor property to UIColor.clear, but it has no effect: when I select text, behind it I see the color that the user selects in System Preferences >> General >> Highlight color.

Here is a picture of the problem: hi.stack.imgur.com/ku2iJ.png

The text is highlighted, but instead of yellow (the background color of the UITextField), it's showing the highlight color (blended with the yellow).

Is this a bug? What's the work around? Any hints would be greatly appreciated!

Accepted Reply

The solution is, when becoming first responder, to set the UITextField's selectedTextRange to nil.

Replies

The solution is, when becoming first responder, to set the UITextField's selectedTextRange to nil.