From 4f405009f5f954f55241931c0a2f16da7228b6d7 Mon Sep 17 00:00:00 2001 From: Nate Weaver Date: Tue, 17 Sep 2019 04:41:57 -0500 Subject: [PATCH] Use a selector instead of a block for the notification observation --- Mac/MainWindow/Detail/DetailWebViewController.swift | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Mac/MainWindow/Detail/DetailWebViewController.swift b/Mac/MainWindow/Detail/DetailWebViewController.swift index b1b364a51..a203600f5 100644 --- a/Mac/MainWindow/Detail/DetailWebViewController.swift +++ b/Mac/MainWindow/Detail/DetailWebViewController.swift @@ -105,9 +105,7 @@ final class DetailWebViewController: NSViewController, WKUIDelegate { webInspectorEnabled = AppDefaults.webInspectorEnabled - NotificationCenter.default.addObserver(forName: .WebInspectorEnabledDidChange, object: nil, queue: OperationQueue.main) { (notification) in - self.webInspectorEnabled = notification.object! as! Bool - } + NotificationCenter.default.addObserver(self, selector: #selector(webInspectorEnabledDidChange(_:)), name: .WebInspectorEnabledDidChange, object: nil) reloadHTML() } @@ -207,6 +205,10 @@ private extension DetailWebViewController { callback(scrollInfo) } } + + @objc func webInspectorEnabledDidChange(_ notification: Notification) { + self.webInspectorEnabled = notification.object! as! Bool + } } // MARK: - ScrollInfo