
Type-safe suspendable navigation with result-passing (primitives and serializable objects), plus a lightweight MVI ViewModel interface to standardize UI state management.
A Kotlin Multiplatform (KMP) library for common androidx extensions, including Navigation and MVI utilities.
NavController. Supports primitives and serializable objects.MviViewModel interface to standardize state management in Compose Multiplatform or Android apps.Add the library dependency to your build.gradle.kts file.
dependencies {
implementation("com.paleblueapps:cmpcore:[latest-version]")
}This extension allows you to navigate to a screen and wait for a result asynchronously.
// Screen A: Navigate and wait for result
val result: String? = navController.navigateForResult("NextScreen")
// Screen B: Navigate back with result
navController.navigateBackWithResult("Success")@Serializable
data class User(val id: String, val name: String)
// Screen A: Navigate and wait for serializable result
val user: User? = navController.navigateForSerializableResult<User>("UserSelectionScreen")
// Screen B: Navigate back with serializable result
navController.navigateBackWithSerializableResult(User("1", "John Doe"))Standardize your ViewModels using the MviViewModel interface.
data class MyState(val isLoading: Boolean = false)
sealed class MyAction { object Refresh : MyAction() }
class MyViewModel : ViewModel(), MviViewModel<MyState, MyAction> {
private val _state = MutableStateFlow(MyState())
override val state: StateFlow<MyState> = _state.asStateFlow()
override fun onAction(action: MyAction) {
when (action) {
MyAction.Refresh -> { /* handle refresh */ }
}
}
}A Kotlin Multiplatform (KMP) library for common androidx extensions, including Navigation and MVI utilities.
NavController. Supports primitives and serializable objects.MviViewModel interface to standardize state management in Compose Multiplatform or Android apps.Add the library dependency to your build.gradle.kts file.
dependencies {
implementation("com.paleblueapps:cmpcore:[latest-version]")
}This extension allows you to navigate to a screen and wait for a result asynchronously.
// Screen A: Navigate and wait for result
val result: String? = navController.navigateForResult("NextScreen")
// Screen B: Navigate back with result
navController.navigateBackWithResult("Success")@Serializable
data class User(val id: String, val name: String)
// Screen A: Navigate and wait for serializable result
val user: User? = navController.navigateForSerializableResult<User>("UserSelectionScreen")
// Screen B: Navigate back with serializable result
navController.navigateBackWithSerializableResult(User("1", "John Doe"))Standardize your ViewModels using the MviViewModel interface.
data class MyState(val isLoading: Boolean = false)
sealed class MyAction { object Refresh : MyAction() }
class MyViewModel : ViewModel(), MviViewModel<MyState, MyAction> {
private val _state = MutableStateFlow(MyState())
override val state: StateFlow<MyState> = _state.asStateFlow()
override fun onAction(action: MyAction) {
when (action) {
MyAction.Refresh -> { /* handle refresh */ }
}
}
}