From the course: iOS Development: Architecture

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

The Model-View-ViewModel pattern

The Model-View-ViewModel pattern

From the course: iOS Development: Architecture

Start my 1-month free trial

The Model-View-ViewModel pattern

- [Narrator] The Model-View-View Model uses the same separation of concerns as the Model-View-Presenter. There are two differences though. The presenter is called view model, but it has the same responsibilities as the presenter. This is just naming. But there's another major difference between the two architectural patterns. MVVM provides two-way data binding. The essence of this feature is how we propagate changes across the layers of our architecture. With data binding, the view and the view model react to model changes automatically, and the model is updated instantly when the user performs relevant changes on the UI. The power of data binding relies in the fact that it requires almost no additional coding. Unfortunately, we don't get data binding for free in iOS, yet there are various ways to implement it using, for example, notifications, key value observing, or delegation. There are also third-party frameworks like Bond, for example. Here's the framework's GitHub page if you…

Contents