junkpiano / yusuke.cloud

Personal Website
https://yusuke.cloud/
1 stars 1 forks source link

posts/nwpathmonitor/ #99

Open utterances-bot opened 3 years ago

utterances-bot commented 3 years ago

NWPathMonitor · Yusuke Ohashi

Introduction NWPathMonitor is a class in Network framework, which observes network status and monitor network interface. It’s available in iOS 12 or later. import Network You must retain NWPathMonitor instances to get callbacks. class NetworkMonitorViewController: ViewController { let monitor = NWPathMonitor() } requiredInterface lets you observe the specific network interface. let wifiMonitor = NWPathMonitor(requiredInterfaceType: .wifi) Here is the list of interfaces that NWPathMonitor supports. https://developer.apple.com/documentation/network/nwinterface/interfacetype Detect network changes monitor.

https://yusuke.cloud/posts/nwpathmonitor/

junkpiano commented 3 years ago

Hello comment!