https://kotlinlang.org logo
#compose
Title
# compose
m

Mantas Varnagiris

03/03/2020, 9:24 PM
I was playing with
compose-router
library made by @Zsolt . Found a few issues regarding back stack sequence and while trying to fix I ended up with a very different code base. I also needed callbacks for navigation events for DI or SL to be able to scope instances. Then I went deeper into it as I want to learn more about Compose and ended up with another navigation library. So here it is. Feel free to use it. Hopefully this is going to be deprecated as soon as Google rolls out their. Now I have some feedback to give them once they start doing it. https://github.com/mvarnagiris/compose-navigation
❤️ 2
👌 1
s

shikasd

03/04/2020, 1:04 AM
Hey, just curious, what did you lack / tried to improve in
compose-router
when you started?
m

molikto

03/04/2020, 7:28 AM
I wonder why a Ambient backstack is not provided for all compose-router and this lib
m

Mantas Varnagiris

03/04/2020, 8:33 AM
@molikto in
compose-navigation
only
NullableBackStackAmbient
is internal. I need that one to find parent back stack. But
BackStackAmbient
is public and will give you closest back stack (You can nest back stacks). You can use it. @shikasd When I started I forked
compose-router
because I was just curious how navigation can be implemented. Then I found issue there where back stack order is not kept (already filed an issue on github). I also needed back stack callbacks - when route was added, removed etc. - to be able to create `Scope`s for my service locator library. And when I was done doing these things - code base ended up being very different from
compose-router
that's why I just published another library. But like I said - I hope they will soon become obsolete 🙂 TLDR: I'm new to Jetpack Compose so I just wanted to learn by doing something 🙂 Also what I thought was pretty cool is that you can do most of your library code in pure java/kotlin library. Android library layer is pretty thin. So if you want to manipulate back stacks in java/kotlin librarty you can by pulling in this dependency
implementation 'com.github.mvarnagiris.compose-navigation:core:{latest_version}'