Hello! Looking into KMM sample I have a question r...
# orbit-mvi
g
Hello! Looking into KMM sample I have a question regarding iOS state object
the code is:
Copy code
@StateObject private var postListViewModel = ViewModels().postListViewModel().asStateObject()
the docs state:
The state is accessed in the screens through a Combine 
@Published
 observable object.
shouldn’t the sample be:
Copy code
@ObservedObject private var postListViewModel = ViewModels().postListViewModel().asObservableObject()
🤔
note: i have 0,01% experience in iOS, I’m giving my first steps 😅
Tip: It is really important that you use
@ObservedObject
only 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
@StateObject
is for.
Remember, please do not use 
@ObservedObject
 to create instances of your object. If that’s what you want to do, use 
@StateObject
 instead.
is it because of this last sentence?
k
I think @StateObject is like Compose's rememberXxx from that description. It's probably not needed to observe a stream...