I hope this is the right place to ask.
I’m an experienced developer, and have used MVC for much time.
This question is in the context of iOS/macOS development for the most part, (SwiftUI).
Using MVC in iOS I always found the paradigm and architecture simple.
- Views contained view related code (layout and reactive code)
- Models were just stores
- Controllers populated models, did all the business/app logic, held references to the the objects that did work (network handlers, data parsers, business logic)
In MVVM, (used in SwiftUI) I’m really struggling with where to put this code.
I see the right approach as:
- Models are still stores they are dumb and get populated by the ViewModel
- Views are pure in terms of their purpose, UI code only, declarative
- ViewModels (I think) hold the logic, have references to objects that do the work, get results from these objects and populate the model, let the view know when things change.
Do I have this right, if not, where does the “controller code” go in MVVM?