Building Robust ViewModels

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

Lesson 02: State Management in ViewModels

Demo 2

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

Continue with your project from the first demo or open TheMet app in the Final demo 1 folder.

try await store.service.getObjectIDs(from: query)
'service' is inaccessible due to 'private' protection level
private let maxIndex: Int
@State var store = TheMetStore(10)
Text("You searched for \(store.maxIndex) '\(query)' objects")
Button("Change maxIndex") {
  store.maxIndex = 2
}
@ObservationIgnored var maxIndex: Int
See forum comments
Cinema mode Download course materials from Github
Previous: Adding Observation Properties Instruction Next: Conclusion