Introduction

Lesson 1 gave you a quick glimpse of how views interact with the mutable data in a view model.

  • You created the @Observable class TheMetStore.
  • You instantiated TheMetStore in ContentView as a @State property.

This lesson takes you deeper into the state management mechanism that enables views to observe and react to changes in the view model.

Learning Objectives

Here’s what you’ll do in this lesson:

  • Implement state management within a ViewModel using Observation.
  • Differentiate between public and private or @ObservationIgnored properties in ViewModels and their appropriate usage scenarios.
See forum comments
Download course materials from Github
Previous: Designing Powerful ViewModels Quiz Next: Instruction