Network Path Monitoring
In iOS 11, Apple recommended you stop using the reachability API to check network availability before attempting a connection. Instead you configure a
URLSession
to wait for connectivity.The wait for connectivity model works better for creating connections but I still sometimes want to show the user a network status indicator.
[…]
Apple released the
Network
framework in iOS 12, macOS 10.14. It includes aNWPathMonitor
that is now the preferred way to monitor changes to network status. The three steps to monitor network changes[…]