HotKey
HotKey copied to clipboard
HotKey is blocking onKeyPress
I use HotKey in my AppDelegate class but now when im trying to use onKeyPress in my view it no longer works. Is there no way to get them to work together?
delegate logic:
let hotKey = HotKey(key: .c, modifiers: [.command, .option])
hotKey.keyDownHandler = {
guard let window = self.window else { return }
if self.hide {
self.hide.toggle()
window.orderOut(nil)
} else {
self.hide.toggle()
window.orderFront(nil)
}
}
self.hotKey = hotKey
View Logic:
GroupBox{
VStack(alignment: .leading) {
CopyCard(copy: clipboardMonitor.copies[index])
}
}
.id(index)
.frame(maxWidth: .infinity)
.listRowSeparator(.hidden)
.focusable()
.focused($selectedIndex, equals: index)
.onKeyPress(.downArrow) {
selectedIndex = index + 1
stateIndex = selectedIndex ?? 0
print("down")
return .handled
}