Repository for project of Medium Blog Network reachability status monitoring on iOS (Part 1)
- Install ReachibilitySwift with
pod ‘ReachabilitySwift’, ‘~> 3’
withcocoapods
- Drag and Drop
ReachabilityManager.swift
to your project from...NetworkStatusMonitorPart1/NetworkStatusMonitor/Networking/Core
Override AppDelegate
's func applicationDidBecomeActive(_:)
func applicationDidBecomeActive(_ application: UIApplication) {
// Starts monitoring network reachability status changes
ReachabilityManager.shared.startMonitoring()
}
Override AppDelegate
's func applicationWillEnterForeground(_:)
func applicationWillEnterForeground(_ application: UIApplication) {
// Stops monitoring network reachability status changes
ReachabilityManager.shared.stopMonitoring()
}