To run the example project, clone the repo, and run pod install
from the Example directory first.
SnapReachability is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'SnapReachability'
import SnapReachability
...
//start listening for network events
ReachabilityManager.shared.stopMonitoring()
ReachabilityManager.shared.addListener(listener: self)
//stop listening for networl events
ReachabilityManager.shared.stopMonitoring()
ReachabilityManager.shared.removeListener(listener: self)
//implement NetworkStatusListnerProtocol
extension YouClas: NetworkStatusListener{
switch reachability.connection {
case .unavailable:
debugPrint("Network became unreachable")
case .wifi:
debugPrint("Network reachable through WiFi")
case .cellular:
debugPrint("Network reachable through Cellular Data")
case .none:
debugPrint("Unkown netwoprk status")
}
}
DominatorVbN, amitsamant@outlook.com
SnapReachability is available under the MIT license. See the LICENSE file for more info.