When to use MVVM and When to use MVC Architecture While Developing iOS ApplicationJuly 14, 2021 Publish By : EXPERT APP DEVS 2 min read Viewed By : 1018
MVC is the architecture consists three main sections:
- The Model
- The View
- The Controller
- MVC framework is an architecture that separates an app in three main components Model, View, and Controller. MVVM facilitates a separation of development of the GUI with the help of mark-up language or GUI code
- In MVC architecture controller is the entry point to the Application And in MVVM architecture the view is the entry point to the Application.
- MVC Model components can be tested separately from the user, while MVVM is easy for separate unit testing.
- In MVC architecture has "one to many" relationships between Controller and View , In MVVC architecture, "one to many" relationships between View and View Model.
- Component Detail :-
- Model is holds all the properties of the particular objects
- Model is providing the data to the required fields not doing any type of operation on it
- View is the face of your app that contains all ui components. This does not contain domain-specific logic. For Ex. Storyboard, XIB and cell is our view of the class where we are showing the data.
- The Controller is that part of the Application that handles the communication between model and view .
- it receives structured data from the Model/ViewModel and passes that data to View to display it on screen.
- Model is holds all the properties of objects.
- Model is providing the data to the required fields on UI not doing any type of logical operation on it
- In MVVM View is the face of your application, the only difference is a load of views is distributed and no logical part is included in View.
- It only gets data from the view model classes and shows the data on view.
- In MVVM Architecture the view doesn’t have direct communication with the model class.
- This thing was newly added in MVVM architecture instead of the Controller.
- That doesn’t mean the controller is not playing any role in MVVM.
- In MVVM controllers are playing the same role as MVC.
- The difference is it doesn’t communicate with the model directly instead it communicates with the View-model. View model performs all the logical operations and relieves the controller.
Need a consultation?
Drop us a line! We are here to answer your questions 24/7.