From 4ced1c499db8874343843f7437ed28304073cbd1 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Sat, 2 Nov 2019 11:32:16 +0100 Subject: [PATCH] Use modern structure for notifications --- .../Sources/AppExtension/InterfaceObserver.swift | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/TunnelKit/Sources/AppExtension/InterfaceObserver.swift b/TunnelKit/Sources/AppExtension/InterfaceObserver.swift index 3dc0629..5792adb 100644 --- a/TunnelKit/Sources/AppExtension/InterfaceObserver.swift +++ b/TunnelKit/Sources/AppExtension/InterfaceObserver.swift @@ -40,14 +40,12 @@ import SwiftyBeaver private let log = SwiftyBeaver.self -extension NSNotification.Name { - - /// A change in Wi-Fi state occurred. - public static let InterfaceObserverDidDetectWifiChange = NSNotification.Name("InterfaceObserverDidDetectWifiChange") -} - /// Observes changes in the current Wi-Fi network. public class InterfaceObserver: NSObject { + + /// A change in Wi-Fi state occurred. + public static let didDetectWifiChange = NSNotification.Name("InterfaceObserverDidDetectWifiChange") + private var queue: DispatchQueue? private var timer: DispatchSourceTimer? @@ -88,7 +86,7 @@ public class InterfaceObserver: NSObject { log.debug("SSID is now '\(current.maskedDescription)'") if let last = lastWifiName, (current != last) { queue?.async { - NotificationCenter.default.post(name: .InterfaceObserverDidDetectWifiChange, object: nil) + NotificationCenter.default.post(name: InterfaceObserver.didDetectWifiChange, object: nil) } } } else {