igor.wojda
06/02/2020, 7:45 PMNavManager class that requires NavController (Android Navigation Component) as collabolator.
What would be the best way to define Koin binding for NavManager class? How instance to NavController could be retrieved (from current Activity?)
class NavManager(private val navController: NavController) {
fun navigate(navDirections: NavDirections) {
navController?.navigate(navDirections)
}
}tynn
06/03/2020, 5:57 AMNavController is bound to the Android lifecycle of its host. I’d suggest to not provide it as a dependency. Instead you could provide a LiveData of navigation destinations. Then you just observe it within the scope of the navigation and provide data from whereever you need to.igor.wojda
06/03/2020, 7:26 AM