Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Screens flow declaration #99

Open
SPopenko opened this issue Mar 11, 2019 · 1 comment
Open

[Question] Screens flow declaration #99

SPopenko opened this issue Mar 11, 2019 · 1 comment

Comments

@SPopenko
Copy link

Hi guys! Thanks for the nice architecture approach.
I'm wondering if you have any recommendations about how to implement navigation flow in the context of ReactorKit?
Like if I need on button click make navigation to a different screen, collect some information there and come back and show it. Usually, it's recommended to implement some FlowControll pattern or use RxFlow for example.

Thoughts?

@devxoul
Copy link
Member

devxoul commented Sep 7, 2019

Not sure those libs are compatible with ReactorKit. In my case I prefer using the vanilla APIs to present a screen and get information using Rx extension from the screen.

extension Reactive where Base: FilterViewController {
  var filterSelected: ControlEvent<SomeFilter> {
    return ControlEvent(source: base.foo)
  }
}

button.rx.tap
  .flatMap(onNext: { [weak self] _ -> Observable<SomeFilter> in
    let filterViewController = FilterViewController()
    self?.present(filterViewController, animated: true, completion: nil)
    return filterViewController.rx.filterSelected
  }
  .map(Reactor.Action.selectFilter)
  .bind(to: reactor.acction)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants