Diagnosing @State updates
A junior asks you why the screen doesn't update after they change a @State value in SwiftUI. Start by explaining what @State is.
A junior asks you why the screen doesn't update after they change a @State value in SwiftUI. Start by explaining what @State is.
@State is a value type source of truth the view owns. The value is kept in SwiftUI's storage outside the view struct so it survives re-evaluation, and when it changes, any body that read it is evaluated again.
SwiftUIMultiple choiceBasics
You're moving a SwiftUI app's ObservableObject code to @Observable. Select all the…
#state #observable
SwiftUIShort answerExpert
This is a SwiftUI live coding review. Find as many defects as you can in the feed screen…
#state #debugging
SwiftUIShort answerAdvanced
When working with an iOS 17 @Observable class in SwiftUI views, using "who owns it" and…
#state #observable
TestingShort answerBasics
If you were testing load() on the view model below, which cases would you verify? …
#state #main-actor