Screen blinking when key press

Hi, I override keyUp function to detect if the space key is press everything works but the screen blink with a white flash every time I press space key how can I fix it?

override func keyUp(with event: NSEvent) {     //Tap on escape 0x31 = Space     if event.keyCode == UInt16(0x31){       print("Hello")     }   }

Can you show a complete code to reproduce the issue? You have not written on which component you have overridden keyUp(with:).

Is not a issue, in macOS, there is an option (System Preferences, Accessibility, Flash the screen when an alert sound...) I just want to override this in my app I don't want the flash screen, its call kSystemSoundID_UserPreferredAlert

I may have been misinterpreting your post. Hope you can solve your issue soon. Good luck.

Screen blinking when key press
 
 
Q