In the previous lesson, you learned how to manage local view state using @State and @Binding, focusing on situations where state is confined to individual views. However, as you start developing more complex SwiftUI applications, you’ll often find the need to manage and share state across multiple views that aren’t directly related. This introduces a new challenge: How can you effectively manage shared state in a way that maintains consistency and reactivity across the entire application?
This lesson introduces @Observable, a powerful component of the Observation framework newly introduced in iOS 17. You’ll explore how @Observable enhances state management in SwiftUI by allowing you to manage shared data across different parts of your application. By implementing @Observable, you’ll ensure that changes to shared data are seamlessly and efficiently propagated across all views that depend on that data.
You’ll continue building out the budget-tracking app by implementing @Observable to manage financial entries. This will involve transitioning the data model from a simple struct to a class that conforms to the Observable protocol. You’ll also extend the app’s functionality by adding a totals section that reacts in real time to changes in the financial entries.
Nv pni etq ox ybey kozpih, pee’qt ogqiswhaks fqi xopojm xelatayiwoag if @Anpexcense um cordwuzk bapqkeg lfadi juxocasehc dlafokuew ep RlajhAE, efkadevt cvoy heab ocbr ili yojg zposevzu oln naexmaobazxi.
See forum comments
This content was released on Jun 20 2024. The official support period is 6-months
from this date.
This introduction sets the stage for exploring @Observable in SwiftUI, focusing on managing and sharing state across multiple views to maintain consistency and reactivity in complex applications. You’ll learn to transition the data model from structs to observable classes and implement a totals section that dynamically updates with changes in financial entries.
Download course materials from Github
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress,
bookmark, personalise your learner profile and more!
Previous: Quiz: Managing Local View State with @State and @Binding
Next: Intro to Observation in SwiftUI
All videos. All books.
One low price.
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.