ReactiveViewModel icon indicating copy to clipboard operation
ReactiveViewModel copied to clipboard

Feedback on MVVM-ification of an app

Open AquaGeek opened this issue 9 years ago • 3 comments

I've been playing around with MVVM and RAC for a little while now and have been updating an old project to MVVM (RAC will come later). I want to make sure I'm understanding how all the pieces fit together. Does anybody have any feedback on that pull?

Thanks in advance.

AquaGeek avatar Jan 30 '15 05:01 AquaGeek

Sorry, but most collaborators' time is pretty limited, so I don't know that anyone will have a chance to read the whole pull request. Do you have a specific question that you'd like an answer to?

jspahrsummers avatar Feb 03 '15 18:02 jspahrsummers

One question that came up as I was going through it was WRT table view handling in the view model.

In Ash’s sample app, he has methods that very closely mirror those of the table view data source. To me it feels like the view model knows too much about the view at that point, so I followed your GroceryList code instead where the view model just exposes the array of items and it’s up to the view layer to map it into the table.

Should the view model be totally agnostic to the view?

AquaGeek avatar Feb 07 '15 05:02 AquaGeek

I do think the view model should be agnostic toward the particular view that it's used with.

However, if a tree structure exists (for example, grocery items by list), it would make sense to expose that on the view model—and that could lead to a very natural mapping of sections/rows in a table view. I would try to preserve the fidelity of the model as much as possible, though, which probably means using some sort of collection type.

Does that help at all?

jspahrsummers avatar Feb 08 '15 06:02 jspahrsummers