solivagant 🔆
[🔴 NOT MAINTAINED] 🔆 Compose Multiplatform Navigation library - 🌸 Pragmatic, type safety navigation for Compose Multiplatform. Based on Freeletics Khonshu Navigation. ♥️ ViewModel, SavedStateHandle, Lifecycle, Multi-Backstacks, Transitions, Back-press handling, and more...

[!WARNING]
This library is no longer maintained.
Development has stopped. No new features, bug fixes, or dependency updates will be published.
The repository is preserved as a reference and for existing users who wish to fork or study the code.
For new projects, use
(Android/Compose) or the official
navigation solution when it becomes available on all platforms.
Credits
-
Most of the code in solivagant-khonshu-navigation-core and libraries is
taken from ,
and ported to and .
Liked some of my work? Buy me a coffee (or more likely a beer)

Docs & Installation
Installation
allprojects {
repositories {
[...]
mavenCentral()
}
}
implementation("io.github.hoc081098:solivagant-navigation:0.5.0")
Snapshot
Snapshots of the development version are available in Sonatype's snapshots repository.
allprojects {
repositories {
...
maven(url = "https://s01.oss.sonatype.org/content/repositories/snapshots/")
}
}
dependencies {
implementation("io.github.hoc081098:solivagant-navigation:0.5.1-SNAPSHOT")
}
Getting started
The library is ported from Freeletics Khonshu Navigation library, so the concepts is similar.
You can read the Freeletics Khonshu Navigation to
understand
the concepts.
👉 Full samples are available here.
1. Create NavRoots, NavRoutes
@Immutable
@Parcelize
data object StartScreenRoute : NavRoot
@Immutable
@Parcelize
data object SearchProductScreenRoute : NavRoute
[!NOTE]
@Parcelize is provided by kmp-viewmodel-savedstate library.
See kmp-viewmodel-savedstate for more details.
2. Create NavDestinations along with Composables and ViewModels
StartScreen.kt
SearchProductScreen.kt
3. Setup
3.1. NavHost
Gather all NavDestinations in a set and use NavEventNavigator to trigger navigation actions.
MyAwesomeApp.kt
3.2. Android
To display MyAwesomeApp on Android, use setContent in Activity / Fragment.
MainActivity.kt
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle) {
super.onCreate()
setContent {
MyAwesomeApp()
}
}
}
3.3. Desktop
To display MyAwesomeApp on Desktop, use androidx.compose.ui.window.application and Window composable:
main.kt
fun main() {
val lifecycleRegistry = LifecycleRegistry()
val savedStateSupport = SavedStateSupport()
application {
val windowState = rememberWindowState()
val lifecycleOwner = rememberLifecycleOwner(lifecycleRegistry)
LifecycleControllerEffect(
lifecycleRegistry = lifecycleRegistry,
windowState = windowState,
)
savedStateSupport.ClearOnDispose()
Window(
onCloseRequest = ::exitApplication,
title = "Solivagant sample",
state = windowState,
) {
LifecycleOwnerProvider(lifecycleOwner) {
savedStateSupport.ProvideCompositionLocals { MyAwesomeApp() }
}
}
}
}
[!TIP]
For more information please check out Desktop sample main.kt
3.4. iOS / tvOS / watchOS
To display MyAwesomeApp on iOS/tvOS/watchOS, use ComposeUIViewController (Kotlin - iosMain SourceSet) and UIViewControllerRepresentable (Swift - native code):
MainViewController.kt
val AppLifecycleOwner by lazy { AppLifecycleOwner() }
fun MainViewController(savedStateSupport: SavedStateSupport): UIViewController {
val lifecycleOwnerUIVcDelegate =
LifecycleOwnerComposeUIViewControllerDelegate(hostLifecycleOwner = AppLifecycleOwner)
.apply { bindTo(savedStateSupport) }
.apply { lifecycle.subscribe(LifecycleObserver) }
return ComposeUIViewController(
configure = { delegate = lifecycleOwnerUIVcDelegate },
) {
LifecycleOwnerProvider(lifecycleOwnerUIVcDelegate) {
savedStateSupport.ProvideCompositionLocals { MyAwesomeApp() }
}
}
}
ComposeView.swift
[!TIP]
For more information please check out iOS sample MainViewController.kt
and iosApp sample ComposeView.swift
4. Use NavEventNavigator in ViewModel s / @Composable s to trigger navigation actions
navigator.navigateTo(DetailScreenRoute("some-id"))
navigator.navigateUp()
navigator.navigateBack()
navigator.navigateBackTo<MainScreenRoute>(inclusive = false)
Samples
Roadmap
🔴 Not maintained
This library is no longer maintained. No new releases, bug fixes, or dependency updates are planned.
The repository remains public for reference. See docs/ for a full retrospective,
architectural patterns worth keeping, and migration guidance toward modern official APIs.
License
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/