Latest 1.2.2
Homepage https://github.com/tokijh/RxSwiftDo
License MIT
Platforms ios 8.0, osx 10.9, tvos 9.0, watchos 2.0
Dependencies RxSwift
Frameworks Foundation
Authors

Swift 4.2
Version
License
Platform

Simplified Observable.do(onNext, onError ...) to Observable.do(on: Event<Value>) like Observable.subscribe(on: Event<Value>)

Notice

Version 1.2.2

  • SUPPORT SWIFT 4.2
  • Support Carthage

Detail

New

.do { (event: Event<Value>) in
    print(event)
}

OR

.do(on: { (event: Event<Value>) in
    print(event)
})

Add filter Event

.do(events: [.next, .error], on: { (event: Event<Value>) in
    print(event)
})
.do(events: [.subscribe, .subscribed]) { (event: Event<Value>) in
    print(event)
}

Previous

.do(onNext: { (value) in
    print("next((value))")
}, onError: { (error) in
    print("error((error))")
}, onCompleted: {
    print("completed")
}, onSubscribe: {
    print("subscribe")
}, onSubscribed: {
    print("subscribed")
}, onDispose: {
    print("dispose")
})

Event

enum Event<Element> {
    case next(Element)  // Action to invoke for each element in the observable sequence.
    case error(Error)   // Action to invoke upon errored termination of the observable sequence.
    case completed      // Action to invoke upon graceful termination of the observable sequence.
    case subscribe      // Action to invoke before subscribing to source observable sequence.
    case subscribed     // Action to invoke after subscribing to source observable sequence.
    case dispose        // Action to invoke after subscription to source observable has been disposed for any reason. It can be either because sequence terminates for some reason or observer subscription being disposed.
}

EventFilter

enum EventFilter {
    case next  // Action to invoke for each element in the observable sequence.
    case error   // Action to invoke upon errored termination of the observable sequence.
    case completed      // Action to invoke upon graceful termination of the observable sequence.
    case subscribe      // Action to invoke before subscribing to source observable sequence.
    case subscribed     // Action to invoke after subscribing to source observable sequence.
    case dispose        // Action to invoke after subscription to source observable has been disposed for any reason. It can be either because sequence terminates for some reason or observer subscription being disposed.
}

Installation

CocoaPods

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

pod 'RxSwiftDo'

Carthage

Add this to Cartfile

github "tokijh/RxSwiftDo" ~> 1.2.2
$ carthage update

Author

tokijh

License

RxSwiftDo is available under the MIT License See the LICENSE file for more info.

Latest podspec

{
    "name": "RxSwiftDo",
    "version": "1.2.2",
    "summary": "RxSwiftDo can use Obserable.do simply",
    "homepage": "https://github.com/tokijh/RxSwiftDo",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "tokijh": "[email protected]"
    },
    "source": {
        "git": "https://github.com/tokijh/RxSwiftDo.git",
        "tag": "1.2.2"
    },
    "swift_version": "4.2",
    "source_files": "Source/**/*.swift",
    "frameworks": "Foundation",
    "dependencies": {
        "RxSwift": [
            ">= 4.0.0"
        ]
    },
    "platforms": {
        "ios": "8.0",
        "osx": "10.9",
        "tvos": "9.0",
        "watchos": "2.0"
    }
}

Pin It on Pinterest

Share This