by selecting Help under my Help menu item or cmd-h no window appears until the menu bar is touched.
myApp.swift file:
import SwiftUI
import QuickLook
@main
struct myApp: App {
@Environment(\.openWindow) var openWindow
@State var helpURL: URL? = nil
var body: some Scene {
WindowGroup {
ContentView()
}
.commandsReplaced {
CommandGroup(before: .appInfo) {
Button("Quit") {
NSApp.terminate(nil)
}.keyboardShortcut("q")
}
CommandGroup(before: .help) {
//FIXME: only shows help if the menu bar is touched again.
Button("Help") {
helpURL = Bundle.main.url(forResource: "help", withExtension: "txt")
}
.keyboardShortcut("h")
.quickLookPreview($helpURL)
}
}
}
}
How should this be coded for proper action?
Thanks
Topic:
App & System Services
SubTopic:
General