How to use MVVM in iOS - State Management and Data Flow through SwiftUI - Example Refactoring Swift

Описание к видео How to use MVVM in iOS - State Management and Data Flow through SwiftUI - Example Refactoring Swift

MVVM (Model - View Model - Model) Swift tutorial. MVVM is a design pattern recommend for SwiftUI 🤩. Next we will see what MVVM means and how it works with SwiftUI. A important part is to understand the data flow. We will see why we use ObservableObject and @Published.
We will be talking about the declarative programming in SwiftUI, where "the truth" comes in. In the view part we will see the difference between @ObservedObject, @StateObject and @EnvironmentObject.
We will use it to improve a sample project and take advantage of it when working in the preview and writing unit tests.

Overview
00:00 Introduction
02:02 Coding example with bad practice
09:48 How does Model - View Model - Model work ⭐️
12:47 MVVM with SwiftUI: State management and data flow ⭐️
26:02 Recoding our coding example to use MVVM
35:58 Advantage of MVVM: dependency injection and showing different states of the view model in the preview
40:56 Advantage of MVVM: easy to include unit testing for SwiftUI projects
44:20 Wrap-up

📖 I wrote a summary blog post about MVVM where you can find all the images from this tutorial here: https://www.swiftyplace.com/blog/swif...
📖 You can read more about how to learn SwiftUI in this block post that I wrote a wile ago.
  / on-the-road-to-learn-swiftui  

If you liked what you learned and you want to see more, check out one of my courses!
👨‍💻 my SwiftUI course https://school.swiftyplace.com/course...
👨‍💻 my Core Data and SwiftUI course https://school.swiftyplace.com/course...
👩🏻‍💻 Combine course https://school.swiftyplace.com/course...


👉 Overview of Property wrappers in SwiftUI    • Property wrappers in SwiftUI: How to ...  
👉 @State vs @Binding    • SwiftUI tutorial for Beginners - @Sta...  
👉 @ObservedObject vs. @StateObject    • SwiftUI by example: @ObservedObject v...  
👉 @Published vs @State    • @Published vs @State - SwiftUI by exa...  
👉 AppStorage and SceneStorage    • SwiftUI 2.0 tutorial -  @State vs @Ap...  

#SwiftUI #Xcode #Programming #DesignPatterns

Комментарии

Информация по комментариям в разработке