From 94a9557ba60973daf34e7e36cf9d2815d2e2d3e3 Mon Sep 17 00:00:00 2001 From: Stuart Breckenridge Date: Mon, 10 Aug 2020 08:01:16 +0800 Subject: [PATCH] Adds sidebar toggling from toolbar. --- .../Shared/SceneNavigationView.swift | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/Multiplatform/Shared/SceneNavigationView.swift b/Multiplatform/Shared/SceneNavigationView.swift index 354142226..a3509699d 100644 --- a/Multiplatform/Shared/SceneNavigationView.swift +++ b/Multiplatform/Shared/SceneNavigationView.swift @@ -8,6 +8,9 @@ import SwiftUI import Account +#if os(macOS) +import AppKit +#endif struct SceneNavigationView: View { @@ -99,6 +102,14 @@ struct SceneNavigationView: View { .toolbar { #if os(macOS) + ToolbarItem(placement: .navigation) { + Button { + NSApp.keyWindow?.firstResponder?.tryToPerform(#selector(NSSplitViewController.toggleSidebar(_:)), with: nil) + } label: { + Image(systemName: "sidebar.left") + } + .help("Toggle Sidebar").padding(.trailing, 40) + } ToolbarItem() { Menu { Button("Add Web Feed", action: { sheetToShow = .web }) @@ -111,8 +122,6 @@ struct SceneNavigationView: View { } ToolbarItem { Button { -// AccountManager.shared.refreshAll(errorHandler: handleRefreshError) - AccountManager.shared.refreshAll(completion: nil) } label: { @@ -130,10 +139,10 @@ struct SceneNavigationView: View { .disabled(sceneModel.markAllAsReadButtonState == nil) .help("Mark All as Read") } - ToolbarItem { - MacSearchField() - .frame(width: 200) - } +// ToolbarItem { +// MacSearchField() +// .frame(width: 200) +// } ToolbarItem { Button { sceneModel.goToNextUnread()