Use native SwiftUI SidebarCommands() for toggle-sidebar menu item

This commit is contained in:
Angelo Stavrow 2020-12-01 09:55:11 -05:00
parent 7902bff33d
commit c1be327694
No known key found for this signature in database
GPG Key ID: 1A49C7064E060EEE

View File

@ -40,15 +40,7 @@ struct WriteFreely_MultiPlatformApp: App {
.keyboardShortcut("r", modifiers: [.command]) .keyboardShortcut("r", modifiers: [.command])
} }
#if os(macOS) #if os(macOS)
CommandGroup(after: .sidebar) { SidebarCommands()
Button("Toggle Sidebar") {
NSApp.keyWindow?.contentViewController?.tryToPerform(
#selector(NSSplitViewController.toggleSidebar(_:)), with: nil
)
withAnimation { self.sidebarIsHidden.toggle() }
}
.keyboardShortcut("s", modifiers: [.command, .option])
}
#endif #endif
} }