SwiftLee

SwiftLee's MVVM in SwiftUI: Using view models without overengineering

Original post MVVM in SwiftUI: Using view models without overengineering

Article Summary

Antoine van der Lee tackles the most common SwiftUI mistake: slapping a view model on everything. His approach? Start simple, add MVVM only when it actually solves a problem.

This practical guide from SwiftLee shows how to use MVVM in SwiftUI without falling into the overengineering trap. Van der Lee walks through when view models add value versus when they just create unnecessary abstraction, using a real contact deletion workflow as an example.

Key Takeaways

Critical Insight

MVVM in SwiftUI works best when you start without it and add view models only when they improve testability, readability, or state management.

Continue reading

What This Article Covers

Problem

SwiftUI developers often can't tell when MVVM actually helps versus when it just adds complexity. The result is bloated codebases where view model layers mostly duplicate what's already in the model.

Solution

Antoine van der Lee suggests a practical test: only add a view model if your view needs to handle async work, transform data, validate input, contain logic worth testing, or talk to multiple services. Use @Observable and @MainActor for the implementation.

Impact

This cuts down on unnecessary abstraction while keeping tests intact. Simple views stay simple. Complex screens get the separation they need without making the code harder to navigate or read.

The article includes a complete testing example showing how to verify deletion workflows without rendering any SwiftUI views.

This page summarizes “MVVM in SwiftUI: Using view models without overengineering” by SwiftLee, published Aug 31, 2026. All credit for the original work goes to the authors.

Read the original on avanderlee.com (opens in new tab)

AI tools for iOS

Browse all AI tools →