UIKit macOS Catalyst beep sound with GCKeyboard

When using GCKeyboard in a UIKit based macOS Catalyst app, on each keypress there is a resulting beep sound heard. Is there a way to disable this beep sound?
Answered by mpguerrette in 616335022
Okay, it was pretty simple. The press handlers for both begin and end should be overridden and handle the input

Code Block swift
override func pressesBegan(_ presses: Set<UIPress>, with event: UIPressesEvent?) {
/*
Do nothing, or handle specifically the keys
that should be processed by your app.
super.pressesBegan will forward the key press and result
in the 'beep' sound
*/
}
override func pressesEnded(_ presses: Set<UIPress>, with event: UIPressesEvent?) {
/*
Do nothing, or handle specifically the keys
that should be processed by your app.
super.pressesEnded will forward the key press and result
in the 'beep' sound
*/
}

This solves the issue of 'beeps' coming from key presses that I am not currently handling while polling using GCKeyboard

Accepted Answer
Okay, it was pretty simple. The press handlers for both begin and end should be overridden and handle the input

Code Block swift
override func pressesBegan(_ presses: Set<UIPress>, with event: UIPressesEvent?) {
/*
Do nothing, or handle specifically the keys
that should be processed by your app.
super.pressesBegan will forward the key press and result
in the 'beep' sound
*/
}
override func pressesEnded(_ presses: Set<UIPress>, with event: UIPressesEvent?) {
/*
Do nothing, or handle specifically the keys
that should be processed by your app.
super.pressesEnded will forward the key press and result
in the 'beep' sound
*/
}

This solves the issue of 'beeps' coming from key presses that I am not currently handling while polling using GCKeyboard

UIKit macOS Catalyst beep sound with GCKeyboard
 
 
Q