Am I right in thinking that the screen structure ...
# compose-android
m
Am I right in thinking that the screen structure most in the "compose" mindset is a single activity with the various screens implemented as composables and routing controlled by a NavController? This project is currently a (multiplatform) single-activity-multiple-fragment structure so I'm considering my best option for moving to composables. The project is early enough in its lifecycle that I'd rather eliminate any tech deficit from this change immediately rather than let it build up.
✔️ 6
s
With the caveat that NavController from androidx.navigation isn't multiplatform, so if you want a MP navigation solution you should look at alternatives.
m
What's your preferred solution for navigation? I've found several libraries, of which Voyager seems like a credible "best".
s
I've never tried myself to work with a MP navigation library. Voyager and decompose are popular choices afaik. I think Circuit has something around this area too.
m
Do you code your own navigation then?
a
m
Thanks for that @Arkadii Ivanov, yes I saw that. Is it your library?
a
No, I believe Decompose-Router is maintained by @xxfast, though it leverages Decompose under the hood.
m
Ah, you're the Decompose author? That's one (rather than Decompose-Router) I looked at
a
Yes, I'm the author of Decompose. 😀
m
Looks great, so why recommend Decompose-Router rather than Decompose?
a
I think @xxfast could explain it better. As far as I understand, some people may prefer handling navigation inside Compose rather than creating separate classes for that. Though, Decompose may have more features (e.g. custom navigation models).
m
Yes, Decompose looked like I'd have to do a lot of "other" things, which may be what you're saying too.
a
What other things that you have to do? I meant that Decompose has many features, that you may want to use. Some features are even unique to Decompose currently.
m
I only looked briefly, but I mean that it was the "creating other classes" thing that stuck out
a
Ah yeah, so you can check alternatives and choose. Also most likely you will need classes for ViewModels anyway. Kinda the same amount of classes.
m
Hmm, really? Ok. I'm feeling my way with this a lot so I guess I'll just have to choose and then take the consequences 😳
s
You'll never know what you really want until you do something and figure out what you're missing. Going with any choice and then bearing the consequences of that choice sounds like a great way to learn things. Plus, next time you'll know how to make a more confident decision.
x
Hi. Decompose-Router uses decompose under the hood and lets you keep all the navigation logic inside Composables themselves. Decompose-router meant to simplify use of decompose in a Compose-only project. Should note that Decompose-router only really support child-stack navigation for now, so if you want other custom navigation models, i would go with Decompose too.