Circuit is a simple, lightweight, and extensible framework for building Kotlin applications that’s Compose from the ground up.
Compose itself is essentially two libraries – Compose Compiler and Compose UI. Most folks usually think of Compose UI, but the compiler (and associated runtime) are actually not specific to UI at all and offer powerful state management APIs.
It builds upon core principles we already know like Presenters and UDF, and adds native support in its framework for all the other requirements we set out for above. It’s heavily influenced by Cash App’s Broadway architecture (talked about at Droidcon NYC, also very derived from our conversations with them).
Circuit’s core components are its
Uicannot directly access each other. They can only communicate through state and event emissions.
- UIs are compose-first.
- Presenters are also compose-first. They do not emit Compose UI, but they do use the Compose runtime to manage and emit state.
Uieach have a single composable function.
- In most cases, Circuit automatically connects presenters and UIs.
Uiare both generic types, with generics to define the
UiStatetypes they communicate with.
- They are keyed by
Screens. One runs a new
Uipairing by requesting them with a given
Screenthat they understand.
The pairing of a
Ui for a given
Screen key is what we semantically call a “circuit”.
- Your application is composed of “circuits”.
- A simple counter
Uipairing would be a “counter circuit”.
- Nested presenter/UIs would be “nested circuits” or “sub circuits”
- Composite presenter/UIs would be “composite circuits”
- etc etc.
Circuit’s repo is being actively developed in the open, which allows us to continue collaborating with external folks too. We have a trivial-but-not-too-trivial sample app that we have been developing in it to serve as a demo for a number of common patterns in Circuit use.
Is it okay to use runBlocking?
In this video I’ll talk about when it’s fine to use the runBlocking function from Kotlin coroutines and when you...
Mobile App Development Best Practices – 07.12
KSP2 Preview, Mastering in SwiftUI, How to implement gamification and more!
Gemini is the new foundation for artificial intelligence in Android
Foundation models are trained on a variety of data sources to create artificial intelligence systems that can adapt to a...
Google has released AlphaCode 2 based on Gemini
Google today, along with its Gemini artificial intelligence model, unveiled AlphaCode 2, an improved version of the AlphaCode code generator...
ColorfulX – Metal for crafting multi-colored gradients
ColorfulX is an implementation using Metal for crafting multi-colored gradients. ColorfulX Platform UIKit and AppKit platforms are generally supported. Due to MTKView not...
Mobile App Development Best Practices – 06.12
Power of enums, A New Foundation for AI on Android, developer dogmas and more!