Reusing a List View in iOS using MVVM

202 views Asked by At

Is it possible to use the same tableview and cells to display a list of contacts (in module a) and list of secondary contacts (module b) in iOS if I use MVVM pattern? If yes, should i place my views in a separate folder?

Thanks

2

There are 2 answers

3
Eike On

I don't get the point with MVVM (are you using REACTIVECOCOA?) and subfolders (having a clean project structure is always useful!) here, but as long as you just want to reuse a table view and it's cells/controller, I would use a embed segue.

From my point of view, the MVVM 'magic' should then happen in the table view itself but is not related to the overall table view reuse.

0
CiNN On

What I do is use a protocol/or base class for the view model so that I can have different view models and use only one tableview controller.