Building Robust ViewModels

Feb 28 2025 · Swift 5.9, iOS 17, Xcode 15.3

Lesson 02: State Management in ViewModels

Demo 1

Episode complete

Play next episode

Next

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

Open TheMet app in the Starter folder or continue with your project from lesson 1.

@Observable class TheMetStore {
  var objects: [Object] = []
  ...
}
@State var store = TheMetStore()
@State var store = TheMetStore()
...
  List(store.objects) { object in
    ...
  }
var store: TheMetStore
ContentView(store: TheMetStore())
@State var store = TheMetStore()
ContentView(store: store)
See forum comments
Cinema mode Download course materials from Github
Previous: Instruction Next: Adding Observation Properties Instruction