Since the introduction of SwiftUI, I have seen many developers write all their code inside views. Unfortunately, the simplicity of the framework seems to encourage a return of many poor practices.
But you do not build robust, maintainable apps by gluing together random pieces of code.
Sure, you can search on Google for specific tasks, copy and paste some code into your project and make it work, somehow.
That works if your app is small and simple. But as soon as you go beyond basic tutorials, you inevitably get serious problems.
That’s why the MVC and MVVM patterns exist. In this article, we will see how they apply to SwiftUI.
Matteo has been developing apps for iOS since 2008. He has been teaching iOS development best practices to hundreds of students since 2015 and he is the developer of Vulcan, a macOS app to generate SwiftUI code. Before that he was a freelance iOS developer for small and big clients, including TomTom, Squla, Siilo, and Layar. Matteo got a master’s degree in computer science and computational logic at the University of Turin. In his spare time he dances and teaches tango.