Search code examples
swiftuitextviewmac-catalystuikitformac

Mac Catalyst textview first responder


I've strange interface behavior when I try to implement my notes app works on Mac with Catalyst. I made textview

textView.becomeFirstResponder()

But after I creating new notes Catalyst in some way moves focus to back button. And after creating another textview focus works as it should.

show image

So it's rotates and I don't understand why textView.becomeFirstResponder() not works everytime.


Solution

  • Try to do this in an asynchronous firebox

    DispatchQueue.main.async{
         textView.becomeFirstResponder()
    }