I am making this app, and I want to detect whether a shift key is being detected. My code is as follows:
override func keyDown(with event: NSEvent) {
if (event.keyCode == Keycode.shift || event.keyCode == Keycode.shift){
//do whatever when the shift key is pressed
print("shift key is being pressed.")
}
}
The struct is from this GitHub: github link here
I tried changing the key code to keyCode.q, and it works fine when q is pressed. It seems as if only the shift key isn't working, and I am not sure why. Any help would be appreciated. Thanks!
Note: When I type regularly, I know my shift key works.