It seems that the examples from WWDC on handling commands by extending command doesn't work since Command no longer exists and the onCommand fucntion wants a selector. It also seems that my custom view can't be made focusable. i have the follwong code.
struct ContentView: View {
var body: some View {
MyView()
.focusable() { print("\($0)") }
.onCommand(Selector("onAny:")) {
print("foo")
}
}
}
struct MyView: View {
var body: some View {
Rectangle()
.fill(Color.blue)
.frame(width: 400, height: 400, alignment: .topLeading)
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
Is there a proper supported way to do this. Or is SwiftUI not ready for real mac app developement yet? I can't add support for copy or paste yet it seems that the view won't become a first responder.