Communicating up the chain from subviews in ReactiveCocoa MVVM world #20
Description
Curious when/if you guys leverage the responder chain. I've been playing with different ways of communicating events and status amongst view controllers and subviews like cells. Of most interest to me is communicating back up that chain, which is where I'm wondering if the responder chain would be a good solution.
For propagating view information down the chain, I've tried different combinations of the the cell just having access to the view controller view model (since it's technically representing some of the data coming from that view model), or subviews/cells having their own view model. The later is certainly more modular, but more work.
My main question lies with some event occurring in a subview/cell (a uibutton tap or a uiswitch flipping) somehow being propagated up to the main view model, ultimately so it can affect other views/cells in the main view (think of flipping a switch and hiding some cells). When the cell shares the view controller's view model, it's easy enough because you just call a method on that view model. When the cell has it's own view model, there are a lot of options, none of which feel quite ideal. You could call a method on the cell view model, which in turn would call a method on it's delegate (the view controller view model). You could expose a signal on the cell view model, which the parent view model observes. There are a few other possible solutions too.
So I've been wondering if it would be easier to not try and send messages back up that chain, but instead use the responder chain to call a method on the view controller, which in turn can update the view model appropriately, which would propagate any changes back down the view model hierarchy.
// cc @ashfurrow