Circuit – A Compose-driven architecture for Kotlin and Android applications
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.
Mobile App Development Best Practices – 06.06
iOS SwiftUI Testing: a Pragmatic Approach Enhancing Security in iOS Applications: Best Practices and Code Examples Beautify Code Without Optionals...
Apple announces Vision Pro augmented reality headset
The Vision Pro is marketed primarily as an AR device, but it can switch between augmented and full virtual reality...
WWDC 2023 Keynote
Check out the WWDC23 keynote, where the latest Apple Vision Pro, MacBook Air 15″, software, services and operating systems were...
LeetCode by Swift – Solutions to LeetCode by Swift
LeetCode Online Judge is a website containing many algorithm questions. Most of them are real interview questions of Google, Facebook, LinkedIn, Apple, etc....
Mobile App Development Best Practices – 05.06
iOS Using Upcoming Feature Flags Network Path Monitoring What’s new in Swift 5.9? Building a robust clean architecture/VIPER iOS app...
Create a game with libGDX
In this exciting episode of our show, we dive into the thrilling world of game development with our guest, Daniele...