Skip to main content

Why MVVM is still the best choice for your iOS app

In iOS development, there’s always something new: a shiny framework, a revamped UI, the latest Swift feature, or a hot architecture pattern. It’s tempting to chase the next big thing.

Every so often, we build a quick proof-of-concept to try out these ideas. But no matter what we try, we always find ourselves coming back to MVVM (Model-View-ViewModel). And for good reasons.

At its core, MVVM is all about inputs and outputs.

The view model defines the actions a user can take, like tapping a button (the inputs), and exposes the data the UI needs to display (outputs).

For example, imagine the login screen of the Duolingo app.

The screenshot of the login screen from the Duolingo app.

Its view model might look something like this:

// Inputs 
func getStartedButtonTapped()
func loginButtonTapped()

// Outputs
@Published var title: String // duolingo
@Published var subtitle: String // Learn for free. Forever.
@Published var getStartedButtonTitle: String // GET STARTED
@Published var loginButtonTitle: String // I ALREADY HAVE AN ACCOUNT

The MVVM architecture scales really well as your app grows. Each screen gets its own view model, so things stay clean and easy to reason about. Add repositories for data and coordinators or navigation paths for navigation, and it’ll serve you well for a long time.

MVVM has a low entry bar. It’s simple to explain and easy to pick up. You can look at a view model and immediately understand what user actions it handles and what data it provides. That makes it easier to debug, review, and collaborate on.

Testing is straightforward. You simulate user actions and check if the outputs change as expected. That’s it.

MVVM works out of the box. No need for external libraries, so you’re never blocked by updates or waiting on bug fixes. You own the entire implementation.

In the end, you really can’t go wrong with MVVM. It’s pragmatic, easy to understand, simple to test, and scales as your app grows. No extra dependencies. No steep learning curve. Just a solid architecture that works.

Give it a try on your next screen. You might not look back.