From 9a1ccc4296e2fe28ecd9c431d74821f2a388088d Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Thu, 27 Dec 2018 21:49:18 -0800 Subject: [PATCH] =?UTF-8?q?Move=20array=20of=20sendToCommands=20from=20App?= =?UTF-8?q?Delegate=20to=20SharingServicePickerDelegate,=20where=20it=20be?= =?UTF-8?q?longs,=20since=20it=E2=80=99s=20the=20only=20place=20where=20it?= =?UTF-8?q?=E2=80=99s=20used.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NetNewsWire/AppDelegate.swift | 4 ---- NetNewsWire/MainWindow/SharingServicePickerDelegate.swift | 6 +++++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/NetNewsWire/AppDelegate.swift b/NetNewsWire/AppDelegate.swift index a581e94df..d7e6a7a33 100644 --- a/NetNewsWire/AppDelegate.swift +++ b/NetNewsWire/AppDelegate.swift @@ -31,10 +31,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations, @IBOutlet var sortByNewestArticleOnTopMenuItem: NSMenuItem! @IBOutlet var checkForUpdatesMenuItem: NSMenuItem! - lazy var sendToCommands: [SendToCommand] = { - return [SendToMicroBlogCommand(), SendToMarsEditCommand()] - }() - var unreadCount = 0 { didSet { if unreadCount != oldValue { diff --git a/NetNewsWire/MainWindow/SharingServicePickerDelegate.swift b/NetNewsWire/MainWindow/SharingServicePickerDelegate.swift index f60dad62c..e49b66352 100644 --- a/NetNewsWire/MainWindow/SharingServicePickerDelegate.swift +++ b/NetNewsWire/MainWindow/SharingServicePickerDelegate.swift @@ -26,9 +26,13 @@ import AppKit return sharingServiceDelegate } + private static let sendToCommands: [SendToCommand] = { + return [SendToMicroBlogCommand(), SendToMarsEditCommand()] + }() + static func customSharingServices(for items: [Any]) -> [NSSharingService] { - let customServices = appDelegate.sendToCommands.compactMap { (sendToCommand) -> NSSharingService? in + let customServices = sendToCommands.compactMap { (sendToCommand) -> NSSharingService? in guard let object = items.first else { return nil