RxReachability adds easy to use RxSwift bindings for ReachabilitySwift.
You can react to network reachability changes and even retry observables when network comes back up.
Available APIs
RxReachability adds the following RxSwift bindings:
reachabilityChanged: Observable<Reachability>
status: Observable<Reachability.NetworkStatus>
isReachable: Observable<Bool>
isConnected: Observable<Void>
isDisconnected: Observable<Void>
Common Usage
1. Be sure to store an instance of Reachability in your ViewController or similar, and start/stop the notifier on viewWillAppear and viewWillDisappear methods.
With RxReachability you can also add a retry when network comes back up with a given timeout.
This does require you to have a stored instance of Reachability though.
RxReachability
RxReachability adds easy to use RxSwift bindings for ReachabilitySwift. You can react to network reachability changes and even retry observables when network comes back up.
Available APIs
RxReachability adds the following RxSwift bindings:
reachabilityChanged: Observable<Reachability>
status: Observable<Reachability.NetworkStatus>
isReachable: Observable<Bool>
isConnected: Observable<Void>
isDisconnected: Observable<Void>
Common Usage
1. Be sure to store an instance of
Reachability
in yourViewController
or similar, and start/stop the notifier onviewWillAppear
andviewWillDisappear
methods.2. Subscribe to any of the bindings to know when a change happens.
Static Usage
1. Be sure to store an instance of
Reachability
somewhere on yourAppDelegate
or similar, and start the notifier.2. Subscribe to any of the bindings to know when a change happens.
Advanced Usage
With RxReachability you can also add a retry when network comes back up with a given timeout. This does require you to have a stored instance of Reachability though.
Installation
Installation via CocoaPods
To integrate RxReachability into your Xcode project using CocoaPods, simply add the following line to your
Podfile
:Installation via Carthage
To integrate RxReachability into your Xcode project using CocoaPods, simply add the following line to your
Cartfile
:Installation via Swift Package Manager (SPM)
To integrate RxReachability into your Xcode project using SPM, simply add the following line to your
Package.swift
:Example
To run the example project, clone the repo, and run
pod install
from the Example directory first.License
This library belongs to RxSwiftCommunity.
RxReachability is available under the MIT license. See the LICENSE file for more info.