ELReachability
is a simple Swift API for checking network reachability. ELReachability
is also designed to work well with, and to utilize other libraries in Electrode-iOS, or THG for short.
ELReachability
can be used to query the current reachability to the internet or to a particular host. It can also be used to receive callbacks when the reachability changes.
Setting up and checking reachability to the internet
// Create a Reachability instance
let theInternets = NetworkStatus.networkStatusForInternetConnection()
// Set up a callback
theInternets.startNetworkStatusMonitoring { (reachable) -> Void in
println("Internet reachability: \(reachable.isReachable)")
println("Using celular: \(reachable.isCellular)")
}
// Synchronous check
println("Reachability to internet: \(theInternets.reachable.isReachable)")
// Stop monitoring
theInternets.stopNetworkStatusMonitoring()
We appreciate your contributions to all of our projects and look forward to interacting with you via Pull Requests, the issue tracker, via Twitter, etc. We're happy to help you, and to have you help us. We'll strive to answer every PR and issue and be very transparent in what we do.
When contributing code, please refer to our Dennis.
The MIT License (MIT)
Copyright (c) 2015 Walmart, WalmartLabs, and other Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.