Guilherme Delgado11/08/2021, 11:30 AM
@StateObject private var postListViewModel = ViewModels().postListViewModel().asStateObject()
The state is accessed in the screens through a Combineobservable object.
@ObservedObject private var postListViewModel = ViewModels().postListViewModel().asObservableObject()
Tip: It is really important that you useonly with views that were passed in from elsewhere. You should not use this property wrapper to create the initial instance of an observable object – that’s what
Remember, please do not useis it because of this last sentence?to create instances of your object. If that’s what you want to do, use
kenkyee11/08/2021, 12:11 PM