Skip to content

Instantly share code, notes, and snippets.

@Mohammed-Alhams
Created October 4, 2023 04:42
Show Gist options
  • Save Mohammed-Alhams/fbd09f8e558a18f0dd1a01df3ceda76b to your computer and use it in GitHub Desktop.
Save Mohammed-Alhams/fbd09f8e558a18f0dd1a01df3ceda76b to your computer and use it in GitHub Desktop.
@SuppressLint("ComposableDestinationInComposeScope")
@Composable
fun NavGraphBuilder.${NAME}ScreenRoute(
navController: NavController,
viewModel: ${NAME}ViewModel = hiltViewModel()
){
composable(
route = ROUTE,
// arguments = listOf(navArgument("exampleArg") { NavType.IntType }),
) {
val state = viewModel.uiState.collectAsStateWithLifecycle()
${NAME}Screen(state.value, viewModel, navController)
}
}
internal class ${NAME}Args() {
constructor(savedStateHandle: SavedStateHandle) :
this(/*checkNotNull(savedStateHandle[conversationIdArg]) as String*/)
companion object{
//const val argName = "exampleArg"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment