79458869

Date: 2025-02-22 00:02:24
Score: 1
Natty:
Report link

Use HotKey

Example:

import SwiftUI
import HotKey

struct ContentView: View {
    let hotKey = HotKey(key: .tab , modifiers: [.option])
    
    var body: some View {
        VStack {}
        .onAppear {
            hotKey.keyDownHandler = buttonHandler
        }
    }
    
    func buttonHandler() {
        /* ... */
    }
}

But I'm still curious in how it can send the shortcuts without Accessibility permission.

Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Oleh Kopyl