sharedKoinViewModel

inline fun <VM : ViewModel> NavBackStackEntry.sharedKoinViewModel(navController: NavController, navGraphRoute: Any? = this.destination.parent?.route): VM

Reuse ViewModel instance from NavBackStackEntry if any, else create ViewModel instance It finds the parentEntry with "navController.getBackStackEntry(navGraphRoute)"

Originally from Philipp Lackner - CMP Bookpedia app

Author

Arnaud Giuliani