Skip to content

muukii/RxAssert

Repository files navigation

RxAssert

CI Status Version License Platform

Usage

Check element in Stream

extension Observable {

    public func assert(message: String = default, _ condition: (Event<E>) -> Bool) -> RxSwift.Observable<Element>

    public func assertNext(message: String = default, _ condition: (E) -> Bool) -> RxSwift.Observable<Element>
}

extension Driver {

    public func assert(message: String = default, _ condition: (Event<E>) -> Bool) -> RxCocoa.Driver<Element>

    public func assertNext(message: String = default, _ condition: (E) -> Bool) -> RxCocoa.Driver<Element>
}
  • Sample1
name
  .assertNext("invalid name") { $0 != "muukii" }
  .subscribe()
  • Sample2
name
  .assert("Don't send error") { event in
    if case .Error = event {
      return false
    }
    return true
  }
  .subscribe()

Requirements

Installation

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

pod "RxAssert"

Author

muukii, m@muukii.me

License

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

About

Check element in Stream

Resources

License

Stars

Watchers

Forks

Packages

No packages published