The MVVM design aids in the elimination of tight connections between the components. The three elements of this architecture are as follows:
Model: A model is a representation of an application’s business logic and data. To put it another way, it is made up of an entity structure. The business logic is included in the model, which includes model classes, remote and local data sources, and the repository.
View: The UI code is contained in the view, which is the application’s visual layer. The ViewModel receives the user’s action from the view. It does not, however, get the response directly. To obtain a response, the view must subscribe to the observables provided by the ViewModel.
ViewModel: ViewModel is an abstract layer in the application that links the View and the Model and functions as a link between them. Because it doesn’t have direct access to the View, it doesn’t know which one needs to be used. Data binding connects the two, and the ViewModel keeps track of all the changes to the View and makes the appropriate modifications to the Model.