I have written this code. My problem is, the keyDown function only listens to certain keys (letters, numbers, space, characters, Tab.). However, it completely ignores keys like caps lock and ⇧ Shift and Control. How can I make it listen to these keys?
class GameClient: NSView {
override var acceptsFirstResponder: Bool {
return true
}
override func keyDown(with event: NSEvent) {
print(event.keyCode)
}
override func keyUp(with event: NSEvent) {
}
}
The answers in the suggested dupe don't fully answer my question. I don't want to see if ⇧ Shift was being pressed while I was pressing A, I want to detect when ⇧ Shift alone is pressed, for example.