RxSwiftAutoRetry 0.9.0

RxSwiftAutoRetry 0.9.0

Maintained by Krystian Bujak, SwingDev Open Source.



  • By
  • Krystian Bujak

RxSwiftAutoRetry

CI Status Version License Platform

RxSwiftAutoRetry is an extension to RxSwift - a well-known Reactive Swift framework. It allows user to retry observable after exponential time. It also provides simple way to randomize time of delay.

Example

To run the example project, clone the repo, and run pod install from the main directory first.

Requirements

  • iOS 8.0+

Installation

From CocoaPods

CocoaPods is a dependency manager, which simplifies adding 3rd-party libraries. To install it, add the following line to your Podfile:

pod 'RxSwiftAutoRetry'

Then, you need to run below comand to install framework into your project:

pod install

Usage

See sample project in Example folder.

retryExponentially is extension method for RxSwift framework (in case to use this method please import RxSwift library.)

Usually using this method looks like it:

observable.retryExponentially()

This method provides set of default values for parameters so its behavior can be customized:

observable.retryExponentially(2, with: 0.9...1.1, scheduler: scheduler) { error in
//Add code
}
Parameters
  • maxAttemptCount - Maximum number of times to repeat the sequence.
  • jitter - Multiplier which randomize delay time. Randomizing value is chosen from given range.
  • scheduler - Scheduler on which the delay will be conducted
  • onRetry - Action which will be invoked after delay on every retry. This is optional parameter.
Default values
  • maxAttemptCount: 3
  • jitter: 0.9...1.1
  • scheduler: ConcurrentDispatchQueueScheduler(queue: DispatchQueue.global())
  • onRetry: nil

License

RxSwiftAutoRetry is available under the MIT license. See the LICENSE file for more info.