Introduction to MVVM: refactoring an MVC app using the MVVM design pattern

My original article — Introduction to MVVM: refactoring a MVC app using the MVVM design pattern — was published on appcoda.com.

[Download the Xcode 9 project from GitHub so you can follow along with my code explanation and try MVVM yourself!]

Design patterns are very important tools for iOS developers to keep in their software engineering arsenals. These patterns, along with several other best practices I’ll mention below, help developers to create reliable and maintainable apps. In other words, design patterns help in managing software complexity. In this tutorial, I’ll introduce you to the “Model-View-ViewModel” or “MVVM” design pattern. For a historical and pragmatic perspective, I’ll compare the very well-known “Model-View-Controller” or “MVC” design pattern, long favored by many iOS developers, to MVVM, which has steadily been gaining traction among the same group of developers.

In order to help you understand these design patterns, I’ll walk you through the design and coding of my app shown here:

Continue reading “Introduction to MVVM: refactoring an MVC app using the MVVM design pattern”