From f0d1b74e34d195e8b35022c156f5847cc24e2416 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Sun, 2 Jan 2022 20:32:42 +0100 Subject: [PATCH] Add Toggle Sidebar button for macOS --- Shared/Navigation/AppSidebarNavigation.swift | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Shared/Navigation/AppSidebarNavigation.swift b/Shared/Navigation/AppSidebarNavigation.swift index 67888d21..034b0ad9 100644 --- a/Shared/Navigation/AppSidebarNavigation.swift +++ b/Shared/Navigation/AppSidebarNavigation.swift @@ -100,6 +100,16 @@ struct AppSidebarNavigation: View { "Current User: \(accounts.current?.description ?? "Not set")" ) } + + #if os(macOS) + ToolbarItem(placement: .navigation) { + Button { + NSApp.keyWindow?.firstResponder?.tryToPerform(#selector(NSSplitViewController.toggleSidebar(_:)), with: nil) + } label: { + Label("Toggle Sidebar", systemImage: "sidebar.left") + } + } + #endif } }