• debug
    • 演示

    debug

    打印所有的订阅,事件以及销毁信息


    演示

    1. let disposeBag = DisposeBag()
    2. let sequence = Observable<String>.create { observer in
    3. observer.onNext("?")
    4. observer.onNext("?")
    5. observer.onCompleted()
    6. return Disposables.create()
    7. }
    8. sequence
    9. .debug("Fruit")
    10. .subscribe()
    11. .disposed(by: disposeBag)

    输出结果:

    1. 2017-11-06 20:49:43.187: Fruit -> subscribed
    2. 2017-11-06 20:49:43.188: Fruit -> Event next(?)
    3. 2017-11-06 20:49:43.188: Fruit -> Event next(?)
    4. 2017-11-06 20:49:43.188: Fruit -> Event completed
    5. 2017-11-06 20:49:43.189: Fruit -> isDisposed