From 11bd3dce22a71c29a36b1291d66c486e8dbb923a Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Fri, 17 Jul 2020 18:05:26 -0500 Subject: [PATCH] Change sidebar context menu to use trailing closure syntax --- .../Shared/Sidebar/SidebarContextMenu.swift | 39 ++++++++++++------- .../Shared/Sidebar/SidebarItemView.swift | 4 +- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/Multiplatform/Shared/Sidebar/SidebarContextMenu.swift b/Multiplatform/Shared/Sidebar/SidebarContextMenu.swift index 5ee2a87ea..c0417c799 100644 --- a/Multiplatform/Shared/Sidebar/SidebarContextMenu.swift +++ b/Multiplatform/Shared/Sidebar/SidebarContextMenu.swift @@ -15,13 +15,15 @@ struct SidebarContextMenu: View { @ViewBuilder var body: some View { if sidebarItem.representedType == .account { - Button(action: {}) { + Button { + } label: { Text("Get Info") #if os(iOS) AppAssets.getInfoImage #endif } - Button(action: {}) { + Button { + } label: { Text("Mark All As Read") #if os(iOS) AppAssets.markAllAsReadImage @@ -30,7 +32,8 @@ struct SidebarContextMenu: View { } if sidebarItem.representedType == .pseudoFeed { - Button(action: {}) { + Button { + } label: { Text("Mark All As Read") #if os(iOS) AppAssets.markAllAsReadImage @@ -39,46 +42,53 @@ struct SidebarContextMenu: View { } if sidebarItem.representedType == .webFeed { - Button(action: {}) { + Button { + } label: { Text("Get Info") #if os(iOS) AppAssets.getInfoImage #endif } - Button(action: {}) { + Button { + } label: { Text("Mark All As Read") #if os(iOS) AppAssets.markAllAsReadImage #endif } Divider() - Button(action: {}) { + Button { + } label: { Text("Open Home Page") #if os(iOS) AppAssets.openInBrowserImage #endif } Divider() - Button(action: {}) { + Button { + } label: { Text("Copy Feed URL") #if os(iOS) AppAssets.copyImage #endif } - Button(action: {}) { + Button { + } label: { Text("Copy Home Page URL") #if os(iOS) AppAssets.copyImage #endif } Divider() - Button(action: {}) { + Button { + } label: { Text("Rename") #if os(iOS) AppAssets.renameImage #endif } - Button(action: {}) { + Button { + } label: { Text("Delete") #if os(iOS) AppAssets.deleteImage @@ -87,20 +97,23 @@ struct SidebarContextMenu: View { } if sidebarItem.representedType == .folder { - Button(action: {}) { + Button { + } label: { Text("Mark All As Read") #if os(iOS) AppAssets.markAllAsReadImage #endif } Divider() - Button(action: {}) { + Button { + } label: { Text("Rename") #if os(iOS) AppAssets.renameImage #endif } - Button(action: {}) { + Button { + } label: { Text("Delete") #if os(iOS) AppAssets.deleteImage diff --git a/Multiplatform/Shared/Sidebar/SidebarItemView.swift b/Multiplatform/Shared/Sidebar/SidebarItemView.swift index 38fff30d4..4990687c9 100644 --- a/Multiplatform/Shared/Sidebar/SidebarItemView.swift +++ b/Multiplatform/Shared/Sidebar/SidebarItemView.swift @@ -36,9 +36,9 @@ struct SidebarItemView: View { if let feed = sidebarItem.feed { feedIconImageLoader.loadImage(for: feed) } - }.contextMenu(menuItems: { + }.contextMenu { SidebarContextMenu(sidebarItem: sidebarItem) - }) + } } }