Which artifact for livedata integration? androidx....
# compose
m
Which artifact for livedata integration? androidx.compose.runtime:runtime-livedata or androidx.lifecycle:lifecycle-viewmodel-compose?
i
androidx.compose.runtime:runtime-livedata
is what has
observeAsState
.
viewmodel-compose
only has APIs for dealing specifically with ViewModels
❤️ 1
m
I used to add only the former and the code worked. For example, I could use ViewModels and as you said, observeAsState. Has that changed? Do I need to add the latter to projects too?
i
There's no
androidx.compose
artifact that gives you ViewModel support, but other artifacts, like Navigation Compose, do pull in
viewmodel-compose
as a transitive dependency, which would make it available to your code as well
❤️ 1