NetworkMonitoring icon indicating copy to clipboard operation
NetworkMonitoring copied to clipboard

If `self` does not exist, the notification will still be sent

Open MKGitHub opened this issue 2 years ago • 0 comments

Hi, If self does not exist, the notification will still be sent – what will the receiver fetch?

func startMonitoring() {
        monitor.pathUpdateHandler = { [weak self] path in
            self?.isConnected = path.status != .unsatisfied
            self?.isExpensive = path.isExpensive
            self?.currentConnectionType = NWInterface.InterfaceType.allCases.filter { path.usesInterfaceType($0) }.first
            
            NotificationCenter.default.post(name: .connectivityStatus, object: nil)
        }
        monitor.start(queue: queue)
    }

MKGitHub avatar Feb 25 '22 23:02 MKGitHub