Hi all! Got an interesting thing to investigate, m...
# multiplatform
a
Hi all! Got an interesting thing to investigate, maybe someone can help In commonCode I have some entity that receive Intent-s and emitting a kotlin.Flow<_State_> (whatever you wanna call it). In Compose I have a LiveData.observeAsState() extension function modifier so it can take Flow-s, so in Compose code we have smth like
Copy code
@Composable
fun SampleComposable() {

val state by sampleDataModel.state.observeAsState(initial = State.Initial)

when (state) {
is State.WooHooo -> Text("Woohoo!")
is State.Error -> Text("")
}

}
Now, can I (and if yes, how) achieve this in SwiftUI + Compose, so I could just
let state = sampleDataModel.state.observe(initial: State.Initial)
After intensive googling I found how I can create a custom Combine Publisher/Subscription and did it. But now I'm stuck, since I'm only getting a Publisher and have no idea what to do next. PS: not sure if asked this in an appropriate channel