MVVM in SwiftUI
If you apply MVVM to a screen in a SwiftUI app that supports iOS 17 and later, how do you define the ViewModel and how does the view own it?
If you apply MVVM to a screen in a SwiftUI app that supports iOS 17 and later, how do you define the ViewModel and how does the view own it?
Put the screen state and action methods in a @MainActor @Observable final class ViewModel, have the view own it as @State private var vm, and inject dependencies through init.
ArchitectureShort answerBasics
Someone proposes moving an app that works fine on MVC over to MVVM. What's the…
#mvvm #viewmodel
ArchitectureMultiple choiceBasics
In MVVM, which of these should a ViewModel not have? Select all that apply.
#mvvm #viewmodel
ArchitectureShort answerBasics
Pick the last screen you built and walk me through it end to end. Where did you put the…
#mvvm #viewmodel
SwiftUIShort answerIntro
A junior asks you why the screen doesn't update after they change a @State value in…
#observable