CombineReachability adds easy to use Combine publishers for ReachabilitySwift.
It adds the ability to react to network reachability changes in a reactive way using the power of Combine.
This library was inspired by the RxSwift Community’s RxReachability library.
APIs
CombineReachability adds the following Combine publishers:
1. Be sure to store an instance of Reachability, and start/stop the notifier by calling try? reachability?.startNotifier() and reachability?.stopNotifier() respectively.
CombineReachability
CombineReachability adds easy to use Combine publishers for ReachabilitySwift. It adds the ability to react to network reachability changes in a reactive way using the power of Combine. This library was inspired by the RxSwift Community’s RxReachability library.
APIs
CombineReachability adds the following Combine publishers:
reachabilityChanged: AnyPublisher<Reachability, Never>
status: AnyPublisher<Reachability.Connection, Never>
isReachable: AnyPublisher<Bool, Never>
isConnected: AnyPublisher<Void, Never>
isDisconnected: AnyPublisher<Void, Never>
Common Usage
1. Be sure to store an instance of
Reachability
, and start/stop the notifier by callingtry? reachability?.startNotifier()
andreachability?.stopNotifier()
respectively.2. Subscribe to any of the publishers to know when a reachability 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 publishers to know when a reachability change happens.
Installation
Installation via CocoaPods
Add the following line to your Podfile and run
pod install
:Installation via Swift Package Manager
File/Swift Packages/Add Package Dependency...
https://github.com/istvan-kreisz/CombineReachability.git
into the repository URL textfield.License
CombineReachability is available under the MIT license. See the LICENSE file for more info.