Benjamin Encz published an article about the architecture of PlanGrid.
They moved to a Flux-inspired “unidirectional flow” approach where state changes are performed in a
Store (in the backend, if you will) and updates pushed to the user interface (the frontend). No ad-hoc view updates, no shortcuts. User events are emitted, handled by the store, and state updates affect the view. That’s it. So it’s always obvious how the user interface got into the state it’s in: all the details are plainly visible in the current state object.
Ben’s post is very deep and detailed. You’ll learn a ton from it:
- architectural discussion: why “unidirection flow”, and why Flux?
- setup of actions/events and the store type
- basic state–view bindings via Reactive Cocoa
- how testing stores (and views) is straightforward with this setup
I can’t wait for the next post in this series. Most of this easily applies to ReSwift, too, of course. And guess who just got inspired to refactor TableFlip so the model and view become even more loosely coupled?
Browse the blog archive