Latest 1.0.1
Homepage https://github.com/pmieszal/RxExtensions
License MIT
Platforms ios 9.0, osx 10.12
Dependencies RxSwift, RxCocoa
Authors

CI Status
Version
License
Platform

Usage

DisposeBagProvider

RxExtensions implements DisposeBagProvider protocol which stores DisposeBag by (get/set)associatedObject. NSObject class is extended to DisposeBagProvider by default, so every Swift system object conformed to NSObject have its own default DisposeBag 🎉.

DisposeBagProvider is naturally public, so you can use it with your objects 🙌

RxExtensions

RxExtensions brings back old RxSwift syntax, which for some reason was deprecated. Who likes to write always observable.subscribe(onNext: { ... }) and deal with ugly parentheses? With RxExtensions you simply type observable.subscribeNext { ... } like in good old times ✌️.

Awailable extensions:

open func doOnNext(_ next: @escaping ((Element) -> Void)) -> Observable<Element>
open func doOnCompleted(_ completed: @escaping (() -> Void)) -> Observable<Element>
open func doOnError(_ error: @escaping ((Error) -> Void)) -> Observable<Element>

open func subscribeNext(_ next: @escaping ((Element) -> Void)) -> Disposable
open func subscribeError(_ error: @escaping ((Error) -> Void)) -> Disposable
open func subscribeCompleted(_ completed: @escaping (() -> Void)) -> Disposable

asPublishSubject()

There is also some useful extension for Observable. You can create your "private" publisher by:

let observable: Observable<Void> = PublishSubject()

observable.asPublishSubject()?.onNext()

Example

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

Requirements

//RxExtensions 1.0.0
pod 'RxSwift', '4.0.0'
pod 'RxCocoa', '4.0.0'

//RxExtensions 0.0.15
pod 'RxSwift', '3.6.1'
pod 'RxCocoa', '3.6.1'

Installation

RxExtensions is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'RxExtensions', '1.0.0'     //Swift 4.0
pod 'RxExtensions', '0.0.15'    //Swift 3.0

Author

Patryk Mieszała, [email protected]

License

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

Latest podspec

{
    "name": "RxExtensions",
    "version": "1.0.1",
    "summary": "Some useful RxSwift/RxCocoa extensions.",
    "description": "Some useful RxSwift/RxCocoa extensions not included in stock libraries.",
    "homepage": "https://github.com/pmieszal/RxExtensions",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "pmieszal": "[email protected]"
    },
    "source": {
        "git": "https://github.com/pmieszal/RxExtensions.git",
        "tag": "1.0.1"
    },
    "platforms": {
        "ios": "9.0",
        "osx": "10.12"
    },
    "source_files": "RxExtensions/Classes/**/*",
    "dependencies": {
        "RxSwift": [
            "~> 4.0.0"
        ],
        "RxCocoa": [
            "~> 4.0.0"
        ]
    },
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This