Skip to content

Instantly share code, notes, and snippets.

@huan-nguyen
Created July 6, 2020 04:57
Show Gist options
  • Select an option

  • Save huan-nguyen/779b67d46fa7059f500d1a8aeabc7e77 to your computer and use it in GitHub Desktop.

Select an option

Save huan-nguyen/779b67d46fa7059f500d1a8aeabc7e77 to your computer and use it in GitHub Desktop.
Pseudo code to illustrate the process of locating Navigator to handle the navigation to a particular destination
/**
This is only pseudo code to illustrate the process of locating Navigator
to handle the navigation to a particular destination.
It is not the real code in Navigation Component.
*/
fun NavController.navigate(@IdRes destinationResId: Int) {
val destination = navGraph.getDestination(destinationResId)
val navigator = navigatorProvider.getNavigator(destination.navigatorName)
navigator.navigate(destination)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment