Thread
#compose
    g

    Gabriel

    1 year ago
    I'm using one of the snapshots of compose for playing with navigation, but I'm not sure how to pass arguments through, for eg I have a list of images, I click on one and want to be taken through to the next screen but with the id or something of the image passed through
    sealed class Screen(val route: String) {
    	object ImageList : Screen("image/list")
    	object ImageItem : Screen("image/item")
    }
    
    @ExperimentalCoroutinesApi
    @InternalCoroutinesApi
    @Composable
    fun BasicNav(viewModel: ImageListViewModel) {
    	navController = rememberNavController()
    	NavHost(navController, startDestination = Screen.ImageList.route) {
    		composable(Screen.ImageList.route) { ImageListScreen(viewModel) }
    	}
    }
    
    fun NavigateTo(screen: Screen) {
    	navController.navigate(screen.route)
    }
    And then I've got a Card with a clickable modifier that calls
    NavigateTo(Screen.ImageItem)
    but don't know how to pass args through the nav
    Think of it like a REST URL -
    images/{id}
    shows the image at
    id
    wisdom

    wisdom

    1 year ago
    Thanks 😊 @Ian Lake
    g

    Gabriel

    1 year ago
    Right, got yah, thanks!!