Artur Matsehor
02/03/2021, 11:47 PM@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