{"id":17065984,"url":"https://github.com/lachlanmckee/hilt-compose-navigation-factory","last_synced_at":"2025-04-12T18:16:01.241Z","repository":{"id":42195026,"uuid":"355344312","full_name":"LachlanMcKee/Hilt-Compose-Navigation-Factory","owner":"LachlanMcKee","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-25T23:36:46.000Z","size":397,"stargazers_count":26,"open_issues_count":11,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-12T18:16:00.154Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LachlanMcKee.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-04-06T22:21:15.000Z","updated_at":"2024-12-04T00:55:28.000Z","dependencies_parsed_at":"2023-09-29T03:40:07.101Z","dependency_job_id":"470390f4-d0d9-41d4-96fa-9395240ed554","html_url":"https://github.com/LachlanMcKee/Hilt-Compose-Navigation-Factory","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LachlanMcKee%2FHilt-Compose-Navigation-Factory","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LachlanMcKee%2FHilt-Compose-Navigation-Factory/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LachlanMcKee%2FHilt-Compose-Navigation-Factory/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LachlanMcKee%2FHilt-Compose-Navigation-Factory/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LachlanMcKee","download_url":"https://codeload.github.com/LachlanMcKee/Hilt-Compose-Navigation-Factory/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248610356,"owners_count":21132924,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T11:05:32.772Z","updated_at":"2025-04-12T18:16:01.210Z","avatar_url":"https://github.com/LachlanMcKee.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hilt Compose Navigation Factory\n\nA set of tools to move the responsibility of building a Compose navigation graph to factories that can be defined within other modules.\n\nBy using this library in conjunction with Dagger Hilt these factories are combined into a `Set` which can then be used to construct the navigation graph via the `hiltNavGraphNavigationFactories` extension function.\n\n## How to use\n\nYou construct any number of `ComposeNavigationFactory` implementations in any modules.\n\n```kotlin\n// This annotation allows the annotation processor to add the ComposeNavigationFactory implementation to the dagger graph.\n@HiltComposeNavigationFactory\ninternal class ExampleComposeNavigationFactory @Inject constructor() : ComposeNavigationFactory {\n  override fun create(builder: NavGraphBuilder, navHostController: NavHostController) {\n    builder.viewModelComposable\u003cExampleViewModel\u003e(\n      route = \"example\",\n      content = {\n        ExampleComposable(\n          viewModel = this,\n          navHostController = navHostController\n        )\n      }\n    )\n  }\n}\n\n@Composable\ninternal fun ExampleComposable(viewModel: ExampleViewModel, navHostController: NavHostController) {\n}\n\n@HiltViewModel\ninternal class ExampleViewModel @Inject constructor() : ViewModel() {\n}\n```\n\nWithin the Composable that hosts the navigation graph you can access the `Set` of factories.\n\n```kotlin\n@Composable\nfun JetpackNavigationHiltApp() {\n  val navController = rememberNavController()\n  val context = LocalContext.current\n\n  // The start destination would still need to be known at this point.\n  NavHost(navController, startDestination = \"example\") {\n    hiltNavGraphNavigationFactories(context).addNavigation(this, navController)\n  }\n}\n```\n\nTo see this in practice, please take a look at the [sample](sample) directory.\n\n## Download\nThis library is available on Maven, you can add it to your project using the following gradle dependencies:\n\n```gradle\nimplementation 'net.lachlanmckee:hilt-compose-navigation-factory:1.3.0'\nannotationProcessor 'net.lachlanmckee:hilt-compose-navigation-factory-compiler:1.3.0'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flachlanmckee%2Fhilt-compose-navigation-factory","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flachlanmckee%2Fhilt-compose-navigation-factory","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flachlanmckee%2Fhilt-compose-navigation-factory/lists"}