Skip to content
This repository has been archived by the owner on Dec 5, 2019. It is now read-only.

Feedback on MVVM-ification of an app #37

Open
AquaGeek opened this issue Jan 30, 2015 · 3 comments
Open

Feedback on MVVM-ification of an app #37

AquaGeek opened this issue Jan 30, 2015 · 3 comments
Labels

Comments

@AquaGeek
Copy link

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.

@jspahrsummers
Copy link
Member

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?

@AquaGeek
Copy link
Author

AquaGeek commented Feb 7, 2015

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?

@jspahrsummers
Copy link
Member

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?

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

No branches or pull requests

2 participants