NetworkMonitoring
NetworkMonitoring copied to clipboard
If `self` does not exist, the notification will still be sent
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)
}