UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

SwiftUI's new Observation approach

Forums > SwiftUI

I just watched the WWDC video on the changes to observable objects and such, and I was wondering if anyone could confirm my understanding. (As I see it, it's really just shortening words and attempting to reduce the number of property wrappers people need to worry about.) Here's what I took away from it:

  1. Rather than using the ObservableObject protocol, we now declare a class @Observable
  2. @EnvironmentObject is now @Environment
  3. @Binding is now @Bindable
  4. @State is ...still @State

As they weren't mentioned, I'm not sure about this one: with the changes, are @StateObject and @ObservedObject no longer necessary?

2      

BUILD THE ULTIMATE PORTFOLIO APP Most Swift tutorials help you solve one specific problem, but in my Ultimate Portfolio App series I show you how to get all the best practices into a single app: architecture, testing, performance, accessibility, localization, project organization, and so much more, all while building a SwiftUI app that works on iOS, macOS and watchOS.

Get it on Hacking with Swift+

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.