https://kotlinlang.org logo
#compose
Title
# compose
p

P.J.

10/20/2020, 11:11 AM
Hey, since we won't need multiple fragments anymore with compose navigation and can go single activity, what would be the best practice for injecting viewmodels with hilt? Injecting them all in the activity and then pass them down?
a

allan.conda

10/20/2020, 11:12 AM
probably nav-graph scoped viewmodels
☝️ 4
p

P.J.

10/20/2020, 11:22 AM
Cheers. How would one achieve that? Still fairly new to programming & android in general, couldn't find a fitting scope annotation in the hilt docs.
a

allan.conda

10/20/2020, 11:25 AM
Checkout this gist full article
Still fairly new to programming & android in general,
Best of luck 🙂 , Dagger already has a high learning curve, and Hilt is just something that supports Dagger. Though Hilt is supposed to simplify things
👏 1
👍 1
Compose is working on built-in support for scoping viewModels within a Composable AFAIK, but it’s not yet available
👀 1
p

P.J.

10/20/2020, 11:43 AM
Thanks mate, i'll have a look 🙂!