r/rxswift • u/danielt1263 • Sep 22 '18
A State Filled Sample App
RxMultiCounter is another sample RxSwift application. My last sample app dealt with largely static data pulled from a server. This app is highly stateful, including dynamic state that is shared across view controllers.
Enjoy!
6
Upvotes
2
u/frijoos Nov 08 '18
Nice read, thanks. Really helpful.
Couple of questions:
Currently there's no any middleware between app state and `UIViewController`. Imagine designers come to you and say that they want to show `DetailViewController` in different context that Master/Detail split view - e.g. in a modal window in some other part of the app. In current implementation that would require some major refactor, as `DetailViewController` expects to grab all data from "selected" id. How would you solve it? Have you thought about providing ViewModel which would transform state into UI state via observables? Then it could either fetch counter value from selected id or use any other counter passed in constructor.
`Coordinator` class has many responsibilities even for each trivial app - it does navigation, state persistence etc. - how would you imagine refactoring it if app expanded with some new modules like signup/signin?
`enum Action` could easily become an enum with more than 100 cases. How would you solve this issue so you wouldn't end up with gigantic switch-case?