SwiftUI - Simple & Clear explanation of ObservableObject @Published @ObservedObject in SwiftUI | SwiftUI for beginners |
This video covers :
1. What is ObservableObject Protocol?
2. What is @Published Proprety Wrapper?
3. What is @ObservedObject Proprety Wrapper?
Tips :-
1. Use @State for simple properties that belong to a single view. They should usually be marked private.
2.Use @ObservedObject for complex properties that might belong to several views. Any time you’re using a reference type you should be using @ObservedObject for it.
3. The @Published attribute is class-constrained. Use it with properties of classes, not with non-class types like structures.
4. We can only use the @ObservedObject property wrapper with the object that conform the ObservableObject protocol.
__________________________________________
If You think this is Helpful for you, so please share and Subscribe my channel . Please share your views in comments .
Good place to learn iOS Application Development , Swift ,SwiftUI. I try explain all the things in very simple and easy manner.
"If you can't explain it simply, you don't understand it well enough."
Albert Einstein
#ObservableObject #@Published #@ObservedObject #SwiftUI | #SwiftUIforbeginners #Proprety Wrapper