Add toolbar button and menu entry to toggle sidebar

This commit is contained in:
Angelo Stavrow 2020-11-24 15:35:26 -05:00
parent 1215a1727a
commit 39ae839052
No known key found for this signature in database
GPG Key ID: 1A49C7064E060EEE
2 changed files with 15 additions and 0 deletions

View File

@ -5,7 +5,19 @@ struct ContentView: View {
var body: some View {
NavigationView {
#if os(macOS)
SidebarView()
.toolbar {
Button(action: {
NSApp.keyWindow?.contentViewController?.tryToPerform(
#selector(NSSplitViewController.toggleSidebar(_:)),
with: nil
)
}, label: { Image(systemName: "sidebar.left") })
}
#else
SidebarView()
#endif
PostListView(selectedCollection: nil, showAllPosts: model.account.isLoggedIn)

View File

@ -22,6 +22,9 @@ struct WriteFreely_MultiPlatformApp: App {
.environment(\.managedObjectContext, LocalStorageManager.persistentContainer.viewContext)
// .preferredColorScheme(preferences.selectedColorScheme) // See PreferencesModel for info.
}
.commands {
SidebarCommands()
}
#if os(macOS)
Settings {