https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
b

bonferroni

04/02/2024, 2:39 PM
does anyone here use the Voyager library for navigation, and what are your impressions?
m

Max

04/02/2024, 2:47 PM
I do. Decided for it since it’s the most simple API-wise. It provides nice Android like ScreenModels (ViewModels) which have directly an auto-canceled coroutine scope. For basic navigation it’s fine (thx to the author for the nice work!). I had some problems with more complex setups like auth flow and nested Navigators. So if you just need one top level navigator it will work, for nested ones you need to check if it works. Animation wise i hope swipe-back will be implemented in the future. But again: since the api is so nice clean (nearly no overhead over pure-compose), it will be easy to switch in the future to the official Jetbrains solution, in case it’s good.
🙌 2
b

bonferroni

04/02/2024, 2:53 PM
thank you! Sounds like it is just what I needed.
j

Jacob Ras

04/02/2024, 3:36 PM
+1 for liking Voyager 🙂 Easy to use + solid behaviour.
v

Vlad

04/03/2024, 8:53 AM
@Max I guess you also faced the issue that nested navigators in the Tabs are not cleared (ScreenModels) when you try to logout user via likely
navigator.replace(Login())
and then when you return into Main() the old nested viewmodels are picked from the store again? Did you find an elegant solution for the issue?
m

Max

04/03/2024, 9:06 AM
@Vlad My issue was that even though navigation wise the nested TabNavigator kind of worked, on iOS as soon as i gave focus to a TextInput, the Composable crashed and the TabNavigator re-initialised. So TextInputs were not useable on iOS. Which was a dealbreaker. What i do now, I handle the main navigation (Splash/Auth/LoggedIn) via pure-Compose - no Voyager. Auth and LoggedIn are each one a Navigator (Auth normal one, LoggedIn a tab).
v

Vlad

04/03/2024, 9:07 AM
Then we have faced very different issues because of the nested navigators
m

Max

04/03/2024, 9:08 AM
FYI: I followed this code recommendation here: https://github.com/adrielcafe/voyager/issues/370#issuecomment-2004696427 This
CurrentScreen()
was the problematic part
5 Views