SubCircuit
SubCircuit is a lightweight version of Circuit for rendering nested presenter/UI pairs that delegate events to an outer component rather than handling navigation themselves. Use it for nested, reusable UI components that don't need direct navigation access, and need to delegate cross-cutting events to a parent. See the SubCircuit docs for more info!
Artifacts
circuitx-subcircuit- Core types (SubScreen, SubPresenter, SubUi, SubCircuitContent).circuitx-subcircuit-codegen- KSP@SubCircuitInjectto wire presenter and UI factories into the DI graph. Supports Anvil (default) and Metro.circuitx-subcircuit-test- A .test {} extension for SubPresenters, built on Molecule and Turbine.
Fixes
SaveableNavStack-isRecordReachable()off-by-one where depth of 0 didn't check the current recordSaveableBackStack- UpdateisRecordReachable()to matchSaveableNavStackbehaviour- [codegen] Propagate qualifier annotations from
@CircuitInjectdeclarations to generated factories.
Changes
Breaking
- Moved
NavDecorationfrombackstacktocircuit-foundationand added aNavigatorparameter toDecoratedContent.AnimatedNavDecoratornow has anupdateNavigatormethod to receive the newNavigatorparameter. This gives decorations direct access to the correct Navigator for handling back gestures. - Add
GestureNavigationEventListenerand an optionallistenerparameter toGestureNavigationDecorationFactory, for observing the back gesture lifecycle (e.g. analytics). It's observational only, theNavigatorstill drives the pop.
Codegen
- Function-based
@CircuitInjectdeclarations now treat any non-circuit-provided parameter as an injected dependency across all modes. The generated factory accepts it as a provider (Provider<T>for Dagger/Anvil/Hilt,() -> Tfor kotlin-inject and Metro) and invokes it once atcreate()time, hoisted above the composablepresenterOf { }/ui { }block so it isn't re-invoked on every recomposition. Parameters already declared asProvider<T>orLazy<T>are passed through as-is rather than re-wrapped. In metro and kotlin-inject modes,() -> Tis also passed through; in Dagger/Anvil/Hilt modes it is treated as a regular dependency. @CircuitInject-annotated classes must now be injectable - annotate the class or a constructor with@Inject. Previously, classes without@Injectsilently generated a direct constructor call that could fail to compile.- [metro] Generate function providers when Metro mode is enabled. Note this requires
enableFunctionProvidersto be set enabled, which will be the default in Metro 1.0.0.
Samples
- Added a composite presenter Inbox sample
- Add iOS support to STAR sample
Misc:
- Kotlin
2.4.0 - Compose
1.11.1 - Migrate to AGP 9
SaveableNavStack&SaveableBackStack- Made theSavers public apis- Remove deprecated X64 Apple targets.
Contributors
Special thanks to the following contributors for contributing to this release!
What's Changed
- Update navigation.md by @SamThompson in #2589
- NavStack fixes by @stagg in #2605
- fix(deps): update jb.lifecycle to v2.10.0 by @slack-oss-bot in #2616
- Add iOS support to STAR sample by @ZacSweers in #2184
- fix(deps): update kotlinpoet to v2.3.0 by @slack-oss-bot in #2631
- chore(deps): update plugin metro to v0.13.2 by @slack-oss-bot in #2642
- Remove detekt by @ZacSweers in #2648
- Extract build-logic + migrate to AGP 9 by @ZacSweers in #2650
- Update AndroidPredictiveBackNavDecorator to handle its back animation by @stagg in #2637
- Make SaveableBackStack and SaveableNavStack savers public by @stagg in #2657
- Propagate qualifier annotations + generate functions in metro by @ZacSweers in #2664
- Support dependency hoisting in function injection code gen by @ZacSweers in #2665
- Some small project isolation work by @ZacSweers in #2667
- Fix emulator.wtf setup by @ZacSweers in #2668
- fix(deps): update anvil to v0.5.4 by @slack-oss-bot in #2684
- fix(deps): update agp to v9.2.1 by @slack-oss-bot in #2687
- fix(deps): update kotlinx-coroutines monorepo to v1.11.0 by @slack-oss-bot in #2693
- chore(deps): update plugin emulatorwtf to v1.6.0 by @slack-oss-bot in #2692
- chore(deps): update gradle to v9.5.1 by @slack-oss-bot in #2696
- fix(deps): update dependency dev.zacsweers.metro:runtime to v1.1.1 by @slack-oss-bot in #2702
- Compose 1.11.0 by @stagg in #2628
- fix(deps): update androidx.compose to v1.11.2 by @slack-oss-bot in #2691
- fix(deps): update dependency androidx.compose.runtime:runtime to v1.11.2 by @slack-oss-bot in #2707
- fix(deps): update ksp monorepo to v2.3.9 by @slack-oss-bot in #2714
- Fix saveable state cleanup for popped records by @easternkite in #2716
- Fix CI connected check task wiring by @ZacSweers in #2721
- Move NavDecoration to circuit-foundation with Navigator parameter by @stagg in #2717
- fix(deps): update jb.compose to v1.11.1 by @slack-oss-bot in #2726
- Add a composite presenter Inbox sample by @ZacSweers in #2720
- docs: fixes broken Droidcon NYC link by @ryanbrookepayne in #2728
- Update to Kotlin 2.4.0 by @ZacSweers in #2647
- Clean up js(IR) usages by @ZacSweers in #2731
- Update dependency com.slack.lint.compose:compose-lint-checks to v1.5.2 by @slack-oss-bot in #2732
- Remove out of date testing info by @WhosNickDoglio in #2736
- Update dependency tornado to v6.5.7 by @slack-oss-bot in #2737
- SubCircuit by @stagg in #2727
New Contributors
- @SamThompson made their first contribution in #2589
- @easternkite made their first contribution in #2716
- @ryanbrookepayne made their first contribution in #2728
- @WhosNickDoglio made their first contribution in #2736
Full Changelog: 0.33.1...0.34.0