Trio: A Compose-based Android Architecture Framework
Trio is a framework built on the Mavericks state management library, designed to address challenges with Fragment-based architecture in Jetpack Compose applications.
Trio introduces the concept of "Trios," which are self-contained blocks comprising a ViewModel, State, and UI. Trios can be nested to form navigation hierarchies.
Trio enforces type-safe navigation and communication between Trios, both within and across module boundaries.
Each Trio has its own ViewModel, which manages state changes through Mavericks reducers.
The UI receives the latest state value from the ViewModel and renders accordingly.
Events are routed back to the ViewModel for further state updates, maintaining unidirectional data flow.
Trios can be tested individually by instantiating them with mocked arguments, State, and Props, providing controlled testing environments.
Args provide static input data, while Props provide dynamic input data.
Reflection and assisted injection are used to automate the creation of UI and ViewModel classes, reducing boilerplate.
Trio standardizes the creation and management of boundaries and state in Compose UI, providing type safety and improved testability.
medium.com
medium.com
Create attached notes ...
