Hi, Has anyone figured out how to implement androi...
# compose
m
Hi, Has anyone figured out how to implement android ViewModel while using the jetbrains compose plugin?
i
Hi. I prepared some example for navigation, but it also contains ViewModels: https://github.com/MatkovIvan/nav_cupcake
👀 4
🌟 1
m
Looks great!
c
Let me know how that ends up working for you Mats. I'm also interested in ViewModels scoped to destinations (like how it works with android) but I noticed in that example that there's only a single view model used across all destinations (I know Ivan has said a few days ago that he kept that because he kept it the same as googles sample that he based his off of)
s
It will work Colton. The entire nav library is built on this concept. Even in the rare scenario where this doesn’t yet work on the MP version of the library, which I doubt, it will work eventually. Already works as noted by Ivan.
i
@Colton Idle it should already work in multiplatform -
NavBackStackEntry
properly implements
ViewModelStoreOwner
m
@Colton Idle It works but there is an issue with sending args in navigations on iOS. Apparently there is an approved pull request to fix this.
c
NICE! I will give that a shot then! I use Koin as well, so maybe my dependency injection will work as well with ViewModel scoped destations. Ah. This is so exciting!!!
👍 1