Last active
June 3, 2021 10:21
-
-
Save LachlanMcKee/0f5dffeb2f5c98815f3e1b46ee405464 to your computer and use it in GitHub Desktop.
Scalable Jetpack Compose Navigation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// An example of a set of factories being used to construct a NavHost. | |
// Potentially defined within the app module | |
@AndroidEntryPoint | |
class ExampleActivity: AppCompatActivity { | |
@Inject | |
lateinit var composeNavigationFactories: @JvmSuppressWildcards Set<ComposeNavigationFactory> | |
@Composable | |
fun JetpackNavigationHiltApp() { | |
val navController = rememberNavController() | |
NavHost(navController, startDestination = "feature1") { | |
composeNavigationFactories.forEach { factory -> | |
factory.create(this, navController) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment