Skip to content

Instantly share code, notes, and snippets.

@twittemb
Last active January 1, 2018 23:30
Show Gist options
  • Save twittemb/d31ac09119808030846c5b85d69f8c1e to your computer and use it in GitHub Desktop.
Save twittemb/d31ac09119808030846c5b85d69f8c1e to your computer and use it in GitHub Desktop.
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