Skip to content
Commitwise
Menu

MVVM

Also called: Model-View-ViewModel

Model-View-ViewModel: the UI observes a ViewModel that holds screen state and logic, separate from the UI code.

Definition

In MVVM, the Model is your data and business logic, the View draws the screen, and the ViewModel turns model data into screen state and handles user actions. The View observes the ViewModel and redraws when state changes, so logic can be unit tested without the UI.

In practice

A LoginViewModel exposes isLoading and errorMessage; the SwiftUI or Compose screen just shows them.

Learn it in context

Lessons that use this term.

Related terms

Esc

Type to search the whole site.