Use a selector instead of a block for the notification observation

This commit is contained in:
Nate Weaver 2019-09-17 04:41:57 -05:00
parent e39fa31bf7
commit 4f405009f5
1 changed files with 5 additions and 3 deletions

View File

@ -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