How to use MVVM with SwiftUI


  • Share on Pinterest

This video explains how to use the MVVM (Model, View, View Model) approach with SwiftUI. This was a viewer request on my YouTube channel so a big thank you for not only the kind comments but for suggesting this topic.

At the start of the video I explain what MVVM is for those that are not familiar with it, this is not specific to Swift or SwiftUI and is a concept used by many programming languages and architectures to separate the data, data manipulation, and display.

This keeps everything nicely organized and the model data as the source of truth for applications.

The View Model is where data is taken from the model and usually manipulated in some way to be given to the display. The example I use is taking a date and time, formatting it differently from the source data, and then displaying it.

If you would like to see more videos like this or suggest a topic, please head over to the contact form and send me a note, thanks.