Skip to content

Instantly share code, notes, and snippets.

@raamcosta
Last active September 28, 2021 01:01
Show Gist options
  • Save raamcosta/bf4cb1bcdcb60dca45288986552c3709 to your computer and use it in GitHub Desktop.
Save raamcosta/bf4cb1bcdcb60dca45288986552c3709 to your computer and use it in GitHub Desktop.
Using Compose Destinations
//region Screen Composables
@Destination(route = "profile")
@Composable
fun ProfileScreen(
id: String,
isEditable: Boolean = false
) {/*...*/}
@Destination(route = "login", start = true)
@Composable
fun LoginScreen() {/*...*/}
@Destination(route = "main_feed")
@Composable
fun MainFeedScreen(
navigator: DestinationsNavigator
) {
//...
navigator.navigate(ProfileScreenDestination.withArgs(id = $id, isEditable = $isOwnUser))
}
@Destination("search")
@Composable
fun SearchScreen() {/*...*/}
//endregion
//region NavHost (surely this is not all.. right? 😮)
Destinations.NavHost(navController = navController)
//endregion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment