Circuit is a Compose-based architecture for Android applications that simplifies UI and presenter logic.
Circuit follows the principles of unidirectional data flow and leverages Compose UI's state management capabilities.
Circuit provides a navigable circuit content for managing screen navigation and extensive APIs for handling UI state and testing.
Deep dives
Circuit: A Compose-based architecture for Android applications
Circuit is a Compose-based architecture for Android applications developed by Slack. It adopts Compose UI and powerful state management APIs to modernize the codebase and bring it from 2016 to 2022. Circuit leverages Compose's unidirectional data flow and provides a simple and cohesive solution for using Compose in the UI layer and powerful state management in the presenter layer. The library is designed to be easy to use, testable, and offers great testability with clear separation of UI and business logic. It also supports multi-platform development and can be used for command-line apps and desktop applications. While still in its early stages, Circuit has already been adopted by some teams at Slack and has received positive feedback. The library is open to contributions and feedback from the community.
The Benefits of Using Circuit
Circuit simplifies the adoption of Compose for Android applications and provides a unified architecture for UI and presenter logic. It enhances testability by using a composable presenter approach, reducing the complexity of tests. Circuit is highly adaptable and can be easily integrated into existing codebases. It offers multi-platform support, allowing developers to build applications for various platforms. The library is designed to be easy to learn and fun to use, making it accessible even for developers new to Compose or circuit-based architectures.
How Circuit Works
Circuit follows the principles of unidirectional data flow and leverages Compose UI's state management capabilities. It uses a presenter to query the model and update the view, enabling easy testing and separation of concerns. Circuit introduces the concept of screens, which act as a key between presenters and UIs. This makes it easy to connect presenters and UIs and share information. The library provides a navigable circuit content for managing screen navigation and an extensive set of APIs for handling UI state, testing, and other common tasks.
Getting Started with Circuit
To get started with Circuit, developers need to add the necessary dependencies to their build file and create a Circuit config instance. Circuit provides two entry points: circuit content for rendering UI and navigable circuit content for managing screen navigation. Developers can take advantage of sample apps and examples available in the Circuit repository to understand usage patterns and best practices. While Circuit is still evolving, it is safe to use and feedback and contributions are welcome from the community to help improve and expand the library.
The Future of Circuit
Circuit is actively being developed and maintained. Slack is using Circuit internally and is committed to its continued improvement. The library aims to provide a robust and flexible architecture for Android applications, empowering developers to leverage the full capabilities of Compose and facilitate the adoption of modern software engineering practices. As Circuit gains more adoption and feedback from the community, it is expected to mature and offer even more features and benefits.
Welcome to the latest episode of Talking Kotlin! In this edition, we are thrilled to have Amrita, Kieran, and Zac, as we dive into a detailed discussion on Circuit - a simple, lightweight, and extensible framework for building Kotlin applications that’s Compose from the ground up.
If you're interested in learning more about Circuit and how it can help streamline your Kotlin development process, be sure to tune in to this episode of Talking Kotlin!
Circuit - https://github.com/slackhq/circuit
Amrita – https://amritav.com/
Zac – https://www.zacsweers.dev/
Kieran – https://twitter.com/kierse
Get the Snipd podcast app
Unlock the knowledge in podcasts with the podcast player of the future.
AI-powered podcast player
Listen to all your favourite podcasts with AI-powered features
Discover highlights
Listen to the best highlights from the podcasts you love and dive into the full episode
Save any moment
Hear something you like? Tap your headphones to save it with AI-generated key takeaways
Share & Export
Send highlights to Twitter, WhatsApp or export them to Notion, Readwise & more
AI-powered podcast player
Listen to all your favourite podcasts with AI-powered features
Discover highlights
Listen to the best highlights from the podcasts you love and dive into the full episode