This repository is not maintained. Arkadii Ivanov continued to work on the fork arkivanov/Decompose.
Please see the project website for documentation and APIs.
Decompose is a Kotlin Multiplatform library for breaking down your code into lifecycle-aware business logic components (aka BLoC), with routing functionality and pluggable UI (Jetpack Compose, Android Views, SwiftUI, JS React, etc.). This project is inspired by Badoos RIBs fork of the Uber RIBs framework.
Please check the Installation section of the documentation.
Here are some key concepts of the library, more details can be found in the documentation.
- Component - every component represents a piece of logic with its own lifecycle, the UI is optional an is plugged externally
- ComponentContext - every component has its own [ComponentContext], which makes components lifecycle-aware and allows state preservation, instances retaining (aka AndroidX
ViewModel
) and back button handling - Router - enables navigation between child components, nested navigation is also supported
- Lifecycle - provides a way to listen for lifecycle events in components
- StateKeeper - makes it possible to preserve state or data in a component when it gets destroyed
- InstanceKeeper - retains instances in your components (similar to AndroidX
ViewModel
) - BackPressedHandler - provides a way to handle and intercept back button presses
Check out the project website for a full description of each sample.
- Decompose — experiments with Kotlin Multiplatform lifecycle-aware components and navigation
- Fully cross-platform Kotlin applications (almost)
Twitter: @arkann1985