I have a simple iOS game that I am porting to Mac. I would like for the user to be able to control the game using their keyboard. There is not native text input (like UITextField
, UITextView
).
How do I listen to key down events in a Mac Catalyst app? It does not seem trivial.
UIKeyCommand
does not work because it seems to be made for combinations (e.g. cmd+c
). I could create a fake text field, but I am looking for a cleaner way to do this. I want to listen to single letters and numbers.
Can I integrate NSResponder::keyDown(with:)
somehow?