I'd like to capture a keypress in my Catalyst app.
UIKeyCommand(input: "", modifierFlags: nil, action: #selector(singleShift))
Unfortunately modifierFlags can't be nil and NSEvent isn't supported on Catalyst. Is there a way to detect single press keys? e.g. for a keyboard app or a game?
The field
modifierFlagsisn't optional, so you can't passnil. It is of the typeUIKeyModifierFlagswhich is anOptionSet, so if you don't want to pass a modifier you can simply pass an empty array.