From 294591d154d2904a2242613d2bd7af0b39fd702f Mon Sep 17 00:00:00 2001 From: Stuart Breckenridge Date: Sat, 4 Jul 2020 22:01:01 +0800 Subject: [PATCH] Fixes compile crash with sidebar toolbar --- Multiplatform/Shared/Add/AddWebFeedView.swift | 3 +-- .../Shared/Sidebar/RegularSidebarContainerView.swift | 1 - Multiplatform/Shared/Sidebar/SidebarToolbar.swift | 11 ++++++++++- NetNewsWire.xcodeproj/project.pbxproj | 2 ++ 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Multiplatform/Shared/Add/AddWebFeedView.swift b/Multiplatform/Shared/Add/AddWebFeedView.swift index f0d745d45..2ab535457 100644 --- a/Multiplatform/Shared/Add/AddWebFeedView.swift +++ b/Multiplatform/Shared/Add/AddWebFeedView.swift @@ -49,11 +49,10 @@ struct AddWebFeedView: View { Form { HStack { Spacer() - Image("FaviconTemplateImage") + Image(rsImage: AppAssets.faviconTemplateImage) .resizable() .renderingMode(.template) .frame(width: 30, height: 30) - .foregroundColor(.accentColor).font(.title) Text("Add a Web Feed") .font(.title) Spacer() diff --git a/Multiplatform/Shared/Sidebar/RegularSidebarContainerView.swift b/Multiplatform/Shared/Sidebar/RegularSidebarContainerView.swift index bd2e05a42..c5311d586 100644 --- a/Multiplatform/Shared/Sidebar/RegularSidebarContainerView.swift +++ b/Multiplatform/Shared/Sidebar/RegularSidebarContainerView.swift @@ -26,7 +26,6 @@ struct RegularSidebarContainerView: View { sidebarModel.delegate = sceneModel sidebarModel.rebuildSidebarItems() } - } } diff --git a/Multiplatform/Shared/Sidebar/SidebarToolbar.swift b/Multiplatform/Shared/Sidebar/SidebarToolbar.swift index 969809e22..77d6a5799 100644 --- a/Multiplatform/Shared/Sidebar/SidebarToolbar.swift +++ b/Multiplatform/Shared/Sidebar/SidebarToolbar.swift @@ -14,7 +14,8 @@ struct SidebarToolbar: ViewModifier { @EnvironmentObject private var appSettings: AppDefaults @StateObject private var viewModel = SidebarToolbarModel() - func body(content: Content) -> some View { + @ViewBuilder func body(content: Content) -> some View { + #if os(iOS) content .toolbar { ToolbarItem(placement: .automatic) { @@ -66,6 +67,14 @@ struct SidebarToolbar: ViewModifier { SettingsView().modifier(PreferredColorSchemeModifier(preferredColorScheme: appSettings.userInterfaceColorPalette)) } } + #else + content + .toolbar { + ToolbarItem { + Spacer() + } + } + #endif } } diff --git a/NetNewsWire.xcodeproj/project.pbxproj b/NetNewsWire.xcodeproj/project.pbxproj index ea58b06bd..dd7e01732 100644 --- a/NetNewsWire.xcodeproj/project.pbxproj +++ b/NetNewsWire.xcodeproj/project.pbxproj @@ -31,6 +31,7 @@ 17D232A924AFF10A0005F075 /* AddWebFeedModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17D232A724AFF10A0005F075 /* AddWebFeedModel.swift */; }; 17D5F17124B0BC6700375168 /* SidebarToolbarModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17D5F17024B0BC6700375168 /* SidebarToolbarModel.swift */; }; 17D5F17224B0BC6700375168 /* SidebarToolbarModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17D5F17024B0BC6700375168 /* SidebarToolbarModel.swift */; }; + 17D5F19524B0C1DD00375168 /* SidebarToolbar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 172199F024AB716900A31D04 /* SidebarToolbar.swift */; }; 3B3A32A5238B820900314204 /* FeedWranglerAccountViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B3A328B238B820900314204 /* FeedWranglerAccountViewController.swift */; }; 3B826DCB2385C84800FC1ADB /* AccountsFeedWrangler.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3B826DB02385C84800FC1ADB /* AccountsFeedWrangler.xib */; }; 3B826DCC2385C84800FC1ADB /* AccountsFeedWranglerWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B826DCA2385C84800FC1ADB /* AccountsFeedWranglerWindowController.swift */; }; @@ -4965,6 +4966,7 @@ 51E4995024A8734C00B667CB /* ExtensionPoint.swift in Sources */, 51E4990E24A808CC00B667CB /* HTMLMetadataDownloader.swift in Sources */, 51E498FB24A808BA00B667CB /* FaviconGenerator.swift in Sources */, + 17D5F19524B0C1DD00375168 /* SidebarToolbar.swift in Sources */, 51E4996724A8760B00B667CB /* ArticleStylesManager.swift in Sources */, 1729529B24AA1FD200D65E66 /* MacSearchField.swift in Sources */, 51408B7F24A9EC6F0073CF4E /* SidebarItem.swift in Sources */,