Skip to content

0.4.0

Compare
Choose a tag to compare
@github-actions github-actions released this 10 Jun 02:27
· 1061 commits to trunk since this release

New:

  • Experimental support for refresh indicators on LazyRow and LazyColumn via refreshing boolean
    and onRefresh lambda. These are experimental because we expect refresh support to migrate to
    some kind of future support for widget decorators so that it can be applied to any widget.
  • DisplayLinkClock is available for iOS and MacOS users of Redwood.
    (Treehouse already had a frame clock for iOS).
  • A WidgetValue (or List<WidgetValue>) produced from the generated testing function's
    awaitSnapshot() can now be converted to a SnapshotChangeList which can be serialized to JSON.
    That JSON can then later be deserialized and applied to a TreehouseView to recreate a full view
    hierarchy from any state. This is useful for unit testing widget implementations, screenshot
    testing, and more.
  • Widget implementations can implement the ChangeListener interface to receive an onEndChanges()
    callback which occurs after all property or event lambda changes in that batch. This can help
    reduce thrashing in response to changes to multiple properties or event lambdas at once.
  • LazyRow and LazyColumn now support a placeholder composable slot which will be used with
    Treehouse when a new item is displayed but before its content has loaded. Additionally, the size
    of these widgets can now be controlled through width and height constraints.

Changes:

  • LayoutModifier has been renamed to Modifier.

  • UI primitives like Dp, Density, and Margin have moved from Treehouse into the Redwood
    runtime (in the app.cash.redwood.ui package).

  • HostConfiguration has moved from Treehouse into the Redwood runtime (in the
    app.cash.redwood.ui package) and is now called UiConfiguration.

  • Composables running in Treehouse now run on a background thread on iOS. Previously they were
    running on the main thread. Interactions with UIKit still occur on the main thread.

  • RedwoodContent function for hosting a Redwood composable within Compose UI has moved into a new
    redwood-composeui artifact as it will soon require a Compose UI dependency.

  • The generated testing function now returns the value which was returned from the testing lambda.

    Before:

    suspend fun ExampleTester(body: suspend TestRedwoodComposition.() -> Unit)

    Now:

    suspend fun <R> ExampleTester(body: suspend TestRedwoodComposition.() -> R): R
  • The Redwood and Treehouse frame clocks now send actual values for the frame time instead of 0.

Fixed:

  • Widgets which accept nullable lambdas for events now receive an initial null value when no
    lambda is set. Previously a null would only be seen after a non-null lambda.
  • Reduce binary impact of each widget's composable function by eliminating a large error string
    generated by the Kotlin compiler for an error case whose occurrence was impossible.
  • The iOS implementation of Row, Column, Spacer, and UIViewChildren now react to size and
    child view changes more accurately according to UIKit norms.

This version only works with Kotlin 1.8.20.