Nacho Ruiz Martin
08/03/2021, 3:50 PMviewModel
to a navigation graph using Jetpack compose navigation?
I would like a viewModel
to be used by several composables and get cleared and reinstantiated when the user exists -> reenters to that screen flow.Nacho Ruiz Martin
08/03/2021, 4:10 PM@Composable
fun App(viewModel : Clazz = getViewModel()) {
...
}
@Composable
fun App2(viewModel : Clazz = getViewModel()) {
...
}
I’m getting different instances of the viewmodel on each composable.
I guess this is expected, but is there any way to share it?Nacho Ruiz Martin
08/03/2021, 5:09 PMval parentViewModel = hiltViewModel<ParentViewModel>(
navController.getBackStackEntry("Parent")
)
is possible with Koin.Nacho Ruiz Martin
08/03/2021, 6:08 PMSlava Glushenkov
08/03/2021, 6:14 PMNacho Ruiz Martin
08/03/2021, 6:15 PMSlava Glushenkov
08/03/2021, 6:40 PMNacho Ruiz Martin
08/03/2021, 9:53 PMNacho Ruiz Martin
08/03/2021, 9:53 PMNacho Ruiz Martin
08/04/2021, 8:35 AMarnaud.giuliani
08/09/2021, 12:39 PMNacho Ruiz Martin
08/09/2021, 12:39 PMarnaud.giuliani
08/09/2021, 12:42 PMNacho Ruiz Martin
08/09/2021, 12:43 PMarnaud.giuliani
08/09/2021, 12:44 PMarnaud.giuliani
08/09/2021, 12:54 PMNacho Ruiz Martin
08/09/2021, 12:55 PMNacho Ruiz Martin
08/09/2021, 1:50 PMarnaud.giuliani
08/09/2021, 1:53 PM