aiReachability
Yet another Reachability implementation
aiReachability is an iOS micro framework for gathering network state for cellular and wi-fi connections.
This framework is a wrapper around the NWPathMonitor class from Apple's Network library and aims to be a simple example on how to gather network state, using native APIs.
Requirements
- Swift 5.1
- Xcode 11
- iOS 12
Features
- Gather both wifi and cellular network state synchronosly.
Installation
- CocoaPods
Just add the following line to your PodFile:
pod 'aiReachability'
And then run the following command on the terminal:
pod install
- Carthage
Just add the entry to your Cartfile:
github "aiFigueiredo/aiReachability"
And then run the following command on the terminal:
carthage update
- Swift Package Manager
Add the package to your Package.swift file, under dependencies:
dependencies: [
.package(url: "https://github.com/aiFigueiredo/aiReachability.git", from: "1.0.0")
]
Usage
import aiReachability
// Instantiate NetworkMonitor Object
let networkMonitor = NetworkMonitor()
// Check wifi network state
print(networkMonitor.wifiState)
// Check cellular network state
print(networkMonitor.wifiState)Contributing
Feel free to contribute to this project by opening issues or opening pull requests.
License
aiReachability's available under the MIT license. See the LICENSE file for more information.