Where to use @StateObject and ObservableObject?

210 Views Asked by At

I'm learning swiftUI and I'm getting confused in @StateObject and @ObservableObject when to use them and where to use them.

1

There are 1 best solutions below

0
On BEST ANSWER

See Apple's Managing Model Data in Your App. ObservedObject comes from a parent view and StateObject instantiates in the View that needs it.