2023-05-26
Following the announcement of Compose for iOS alpha, this release adds ios()
and iosSimulatorArm64()
targets for the Circuit core artifacts. Note that this support doesn't come with any extra APIs yet for iOS, just basic target support only. We're not super sure what direction we want to take with iOS, but encourage others to try it out and let us know what patterns you like. We have updated the Counter sample to include an iOS app target as well, using Circuit for the presentation layer only and SwiftUI for the UI.
Note that circuit-codegen and circuit-codegen-annotations don't support these yet, as Anvil and Dagger only support JVM targets.
More details can be found in the PR: slackhq#583
- Use new baseline profile plugin for generating baseline profiles.
- Misc sample app fixes and updates.
- Add window size class example to STAR sample.
- Switch to Roborazzi for screenshot test samples.
- Small documentation updates.
- Add bi-directional Flow/Circuit interop to interop sample.
Note that we unintentionally used an experimental animation API for NavigatorDefaults.DefaultDecotration
, which may cause R8 issues if you use a newer, experimental version of Compose animation. To avoid issues, copy the animation code and use your own copy compiled against the newest animation APIs. We'll fix this after Compose 1.5.0 is released.
androidx.activity -> 1.7.2
compose -> 1.4.3
compose-compiler -> 1.4.7
coroutines -> 1.7.1
kotlin -> 1.8.21
kotlinpoet -> 1.13.2
turbine -> 0.13.0
2023-04-06
circuit-runtime
: common runtime components likeScreen
,Navigator
, etc.circuit-runtime-presenter
: thePresenter
API, depends oncircuit-runtime
.circuit-runtime-ui
: theUi
API, depends oncircuit-runtime
.circuit-foundation
: the circuit foundational APIs likeCircuitConfig
,CircuitContent
, etc. Depends on the first three.
The goal in this is to allow more granular dependencies and easier building against subsets of the API. For example, this would allow a presenter implementation to easily live in a standalone module that doesn't depend on any UI dependencies. Vice versa for UI implementations.
Where we think this could really shine is in multiplatform projects where Circuit's UI APIs may be more or less abstracted away in service of using native UI, like in iOS.
Before | After |
---|---|
com.slack.circuit.CircuitContext | com.slack.circuit.runtime.CircuitContext |
com.slack.circuit.CircuitUiState | com.slack.circuit.runtime.CircuitUiState |
com.slack.circuit.CircuitUiEvent | com.slack.circuit.runtime.CircuitUiEvent |
com.slack.circuit.Navigator | com.slack.circuit.runtime.Navigator |
com.slack.circuit.Screen | com.slack.circuit.runtime.Screen |
Before | After |
---|---|
com.slack.circuit.Presenter | com.slack.circuit.runtime.presenter.Presenter |
Before | After |
---|---|
com.slack.circuit.Ui | com.slack.circuit.runtime.presenter.Ui |
Before | After |
---|---|
com.slack.circuit.CircuitCompositionLocals | com.slack.circuit.foundation.CircuitCompositionLocals |
com.slack.circuit.CircuitConfig | com.slack.circuit.foundation.CircuitConfig |
com.slack.circuit.CircuitContent | com.slack.circuit.foundation.CircuitContent |
com.slack.circuit.EventListener | com.slack.circuit.foundation.EventListener |
com.slack.circuit.NavEvent | com.slack.circuit.foundation.NavEvent |
com.slack.circuit.onNavEvent | com.slack.circuit.foundation.onNavEvent |
com.slack.circuit.NavigableCircuitContent | com.slack.circuit.foundation.NavigableCircuitContent |
com.slack.circuit.NavigatorDefaults | com.slack.circuit.foundation.NavigatorDefaults |
com.slack.circuit.rememberCircuitNavigator | com.slack.circuit.foundation.rememberCircuitNavigator |
com.slack.circuit.push | com.slack.circuit.foundation.push |
com.slack.circuit.screen | com.slack.circuit.foundation.screen |
- [Core] Remove Android-specific
NavigableCircuitContent
and just use common one. Back handling still runs throughBackHandler
, but is now configured inrememberCircuitNavigator
. - [Core] Add
defaultNavDecoration
toCircuitConfig
to allow for customizing the defaultNavDecoration
used inNavigableCircuitContent
. - [Core] Mark
CircuitUiState
as@Stable
instead of@Immutable
. - [Code gen] Capitalize generated class names when source is a presenter function.
- [Sample] New
:samples:tacos
order builder sample to demonstrate complex state management. - [Sample]
NavigableCircuitContent
example in the desktop counter. - [Dependencies] Update compose to
1.4.1
. - [Dependencies] Update compose-compiler to
1.4.4
. - [Dependencies] Update androidx.activity to
1.7.0
. - [Dependencies] Update molecule to
0.7.1
.
2023-02-10
- New: Multiplatform support for
NavigableCircuitContent
! Special thanks to @ashdavies for contributions to make this possible. - Fix:
circuit-retained
minSdk is now 21 again. We accidentally bumped it to 28 when merging in its instrumentation tests. - Enhancement: embedded baseline profiles are now embedded per-artifact instead of in the root
circuit-core
artifact. - Enhancement:
circuit-retained
is now covered in embedded baseline profiles. - [Code Gen] Update Dagger to
2.45
. - [Code Gen] Update KSP to
1.8.10-1.0.9
. - Update to compose-compiler
1.4.2
. - Update to Kotlin
1.8.10
.
2023-02-02
Happy groundhog day!
-
Breaking API change:
Ui.Content()
now contains aModifier
parameter.This allows you to pass modifiers on to UIs directly.
public interface Ui<UiState : CircuitUiState> { - @Composable public fun Content(state: UiState) + @Composable public fun Content(state: UiState, modifier: Modifier) }
-
New: Add
Navigator.resetRoot(Screen)
function to reset the backstack root with a new root screen. There is a correspondingawaitResetRoot()
function added toFakeNavigator
. -
New: Add
EventListener.start
callback function. -
New: Add Compose UI dependency to circuit-core (to support
Modifier
in the API). -
Fix: Fix
CircuitContext.putTag
generics. -
Fix: Fix KSP code gen artifact to just be a pure JVM artifact.
-
Fix:
EventListener.onState
's type is nowCircuitUiState
instead ofAny
. -
Removed:
ScreenUi
is now removed andUi.Factory
simply returnsUi
instances now. -
API Change:
CircuitConfig.onUnavailableContent
is now no longer nullable. By default it displays a big ugly error text. If you want the previous behavior of erroring, replace it with a composable function that just throws an exception. -
Dependency updates
Kotlin 1.8.0
Compose-JB 1.3.0
KSP 1.8.0-1.0.9
Compose Runtime 1.3.3
Compose UI 1.3.3
Compose Animation 1.3.3
2022-12-22
- Enhancement: Circuit no longer requires manual provisioning of its internal backing
ViewModel
s. This is now done automatically by the Circuit itself. - Enhancement:
circuit-retained
is now fully optional and not included as a transitive dependency of circuit-core. If you want to use it, see its installation instructions in its README. - Enhancement: Mark
Screen
as@Immutable
. - Breaking API Change:
LocalCircuitOwner
is now justLocalCircuitConfig
to be more idiomatic. - Breaking API Change:
LocalRetainedStateRegistryOwner
is now justLocalRetainedStateRegistry
to be more idiomatic. - Breaking API Change:
Continuity
is nowinternal
and not publicly exposed since it no longer needs to be manually provided. - Breaking API Change:
ViewModelBackStackRecordLocalProvider
is nowinternal
and not publicly exposed since it no longer needs to be manually provided. - Fix: Add missing license info to pom.
- Dependency updates
[versions] anvil = "2.4.3" compose-jb = "1.2.2" compose-animation = "1.3.2" compose-compiler = "1.3.2" compose-foundation = "1.3.1" compose-material = "1.3.1" compose-material3 = "1.0.1" compose-runtime = "1.3.2" compose-ui = "1.3.2" kotlin = "1.7.22"
2022-12-07
- Breaking API Change:
Presenter
andUi
factories'create()
functions now offer aCircuitContext
parameter in place of aCircuitConfig
parameter. This class contains aCircuitConfig
, a tagging API, and access to parent contexts. This allows for plumbing your own metadata through Circuit's internals such as tracing tools, logging, etc. - Enhancement: New lifecycle functions added to
EventListener
.onBeforeCreatePresenter
onAfterCreatePresenter
onBeforeCreateUi
onAfterCreateUi
onUnavailableContent
onStartPresent
onDisposePresent
onStartContent
onDisposeContent
dispose
- Update Compose to
1.3.1
. - Update Compose (JB) to
1.2.1
. - Update Molecule to
0.6.1
. - Added a demo to the STAR sample that shows how to navigate to standard Android components (#275).
2022-11-07
- Enhancement: Add back the
onRootPop()
parameter inrememberCircuitNavigator()
but useLocalOnBackPressedDispatcherOwner
for backpress handling by default.
2022-11-01
- New: The Overlay API is now extracted to a separate, optional
circuit-overlay
artifact. - New: The
circuit-core
artifact now packages in baseline profiles. - Enhancement: Simplify backstack root pop handling. There is no more
onRootPop()
option inrememberCircuitNavigator()
, instead you should install your ownBackHandler()
prior to rendering your circuit content to customize back behavior when the circuitNavigator
is at root. - Fix:
circuit-codegen-annotations
is now a multiplatform project and doesn't accidentally impose the compose-desktop dependency.
We've also updated a number of docs around code gen, overlays, and interop (including a new interop sample).
2022-10-27
- Enhancement: Code gen now supports non-assisted constructor-injected types.
- Enhancement: Code gen checks that functions and classes are visible to generated factories.
2022-10-27
- Fix: Code gen didn't properly handle instantiating simple class types.
2022-10-26
-
New: Code gen artifact. This targets specifically using Dagger + Anvil and will generate
Presenter
andUi.Factory
implementations for you. SeeCircuitInject
for more details.ksp("com.slack.circuit:circuit-codegen:x.y.z") implementation("com.slack.circuit:circuit-codegen-annotations:x.y.z")
-
New: There is now an
EventListener
API for instrumenting state changes for a givenScreen
. See its docs for more details. -
Fix: Rework
rememberRetained
implementation and support for multiple variables. Previously it only worked with one variable. -
Fix: Clean up some unnecessary transitive dependencies in misc artifacts.
Dependency updates
androidx.activity 1.6.1
androidx.compose 1.3.0
Molecule 0.5.0
2022-10-12
- Update to compose-jb
1.2.0
. - Update to Turbine
0.12.0
. - Fix: Accidentally running molecule twice in
Presenter.test()
.
2022-10-10
- Fix: Accidentally bundling more Compose UI dependencies than necessary.
2022-10-10
Initial release, see the docs: https://slackhq.github.io/circuit/.
Note that this library is still under active development and not recommended for production use. We'll do a more formal announcement when that time comes!