Hey guys, I'm currently experimenting with Compose...
# compose
m
Hey guys, I'm currently experimenting with Compose Multiplatform Navigation. I first used PreCompose because it was close to the original Jetpack navigation, but due to the lack of support for working with navigation arguments in the ViewModels (no SavedStateHandle that could be injected by Koin), I switched to Voyager. Here I was able to access the navigation arguments from the screen in the ScreenModel by making it the inner class of the screen. However, as there is no URL equivalent representation of the current navigation target, I'm a bit confused about navigating to nested screens. Suppose there are two tabs, each consisting of one screen, what's the recommended way to navigate from screen one (in tab one) to screen two (in tab two)?
d
> because it was close to the original Jetpack navigation I would say this is a major reason to not choose it. Jetpack Navigation is imperative, matching the ethos of View XML it was built for. Jetpack Compose is a declarative framework; why not embrace this and also use declarative navigation? Your state as a destination +
when
is all you need in many cases. You may need to augment this with ways to save/restore view-layer state (e.g. scroll position) in some cases; again, Compose provides for this itself.