Last active
January 1, 2018 23:30
-
-
Save twittemb/d31ac09119808030846c5b85d69f8c1e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nextPresentable.rxFirstTimeVisible.subscribe(onSuccess: { [unowned self, | |
unowned nextPresentable, | |
unowned nextStepper] (_) in | |
// we listen to the presentable's Stepper. | |
// For each new Step value, we trigger a new navigation process | |
// this is the core principle of the whole RxFlow mechanism | |
// The process is paused each time the presentable is not currently displayed | |
// for instance when another presentable is above it in the VCs hierarchy. | |
nextStepper.steps | |
.pausable(nextPresentable.rxVisible.startWith(true)) | |
.asDriver(onErrorJustReturn: NoStep()) | |
.drive(onNext: { [unowned self] (step) in | |
// the nextPresentable's Stepper fires a new Step | |
self.steps.onNext(step) | |
}).disposed(by: nextPresentable.disposeBag) | |
}).disposed(by: self.disposeBag) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment