Skip to content
This repository has been archived by the owner. It is now read-only.
Shortcuts for RxSwift & RxCocoa.
Branch: master
Clone or download

README.md

RxShortcuts

CocoaPods Swift 3.0.x License Platform

Shortcuts for RxSwift/RxCocoa.

Warning! Since RxSwift 3.0.0 (and Swift 3.0), shortcuts like subscribeNext, doOnNext etc. have been removed from the core library. There was a reason for that and let me quote @kzaher about the shortcuts (old extensions):

The downsides of old extensions were inconsistencies with Swift API guidelines. They also weren't expressing that calling them actually performes additional subscriptions and thus potentially additional work beside just registering observers.

However I really like these shortcuts and I'm using them in my projects anyways, so I though that I would share.

Shortcuts

List of available shortcuts for RxSwift:

subscribeNext(_:)
subscribeError(_:)
subscribeCompleted(_:)

doOnNext(_:)
doOnError(_:)
doOnCompleted(_:)

[Observable.just(1)].merge()
[Observable.just(1)].concat()
[Observable.just(1)].zip(_:)
[Observable.just(1)].combineLatest(_:)

List of available shortcuts for RxCocoa (and Driver):

driveNext(_:)
driveCompleted(_:)

doOnNext(_:)
doOnCompleted(_:)

If you think that there should be more, please make an Issue or Pull Request.

Example

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

Requirements

  • RxSwift ~> 3.0.0

Installation

If you want the shortcuts only for RxSwift, add the following line to Podfile:

pod "RxShortcuts"

If you want the shortcuts for both RxSwift and RxCocoa, then add this line:

pod "RxShortcuts/RxCocoa"

Author

Sunshinejr, thesunshinejr@gmail.com, @thesunshinejr

License

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

You can’t perform that action at this time.