Decompose
Kotlin Multiplatform lifecycle-aware business logic components (aka BLoCs) with routing functionality and pluggable UI (Jetpack Compose, SwiftUI, JS React, etc.), inspired by Badoos RIBs fork of the Uber RIBs framework
Install / Use
/learn @badoo/DecomposeREADME
Maintenance notice
This repository is not maintained. Arkadii Ivanov continued to work on the fork arkivanov/Decompose.
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.
Setup
Please check the Installation section of the documentation.
Overview
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
Component hierarchy
<img src="docs/media/ComponentHierarchy.png" width="512">Pluggable UI hierarchy
<img src="docs/media/PluggableUiHierarchy.png" width="512">Typical component structure
<img src="docs/media/ComponentStructure.png" width="512">Samples
Check out the project website for a full description of each sample.
Articles
- Decompose — experiments with Kotlin Multiplatform lifecycle-aware components and navigation
- Fully cross-platform Kotlin applications (almost)
Author
Twitter: @arkann1985
If you like this project you can always <a href="https://www.buymeacoffee.com/arkivanov" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-blue.png" alt="Buy Me A Coffee" height=32></a> ;-)
Related Skills
node-connect
329.7kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
81.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
329.7kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
81.2kCommit, push, and open a PR
