jetc.dev Newsletter Issue #260

Published: 2025-04-08

It’s a short issue this week, but we look at wrapping: wrapping text across lines, wrapping composables across rows, and wrapping composables in Swift UI. We optimize composables and Hot Reload. Plus, we build some forms and connect to WebRTC-based streaming.

One Off the Stack, One Off the Slack

You’ve got questions. That’s understandable!

How Can I Have Text() Shrink When It Word-Wraps?

Using maxLines, you can have Text() word-wrap. However, when that occurs, the width of the Text() does not shrink to match the wrapped text — it remains at the maximum width. See how to use onTextLayout to resize the Text() when it wraps in this week’s highlighted Stack Overflow question.

How Do I Do My Own Wrapping, with Conditional Content?

If you have a collection of composables that should lay out in a row and wrap if the row gets too long, use FlowRow(). But, what if you want different composables in cases where it does not wrap and cases where it does? Use a custom layout? Use SubcomposeLayout()? Complain to your graphic designer?!? Learn the trade-offs between those first two options in this week’s highlighted Kotlinlang #compose Slack thread.

Composable Commentary

Posts, videos, and other new information related to Jetpack Compose!

Medium: Optimizing Jetpack Compose with Compiler Reports

Ataer Caner Çelik looks at Compose Compiler Reports and how they can help identify places where problematic parameter types are causing unnecessary recompositions.

Medium: Preserving WebView State in Jetpack Compose

We often need to employ a WebView, but then we need to consider its state with respect to recomposition. This gets even more complex in a Compose Multiplatform project. DongYeon-Lee explores a pair of alternatives for how to address this concern.

Medium: Using Composables inside SwiftUI with Compose Multiplatform

Italo Melo walks us through the process for exporting a composable as an XCFramework, then enclosing it in a SwiftUI-compatible wrapper for use in an iOS/SwiftUI project.

Being Quick: Resolve what’s dirty

Sebastian Sellmair (Mastodon, Bluesky) reports on some of the work going into Compose Hot Reload, focusing on performance tuning. Specifically, Sebastian examines how Hot Reload determines what needs to be reloaded and how some algorithm changes cut the performance curve from O(n²) to something closer to O(1).

KMP pagination using Jetpack Paging 3

Carlos Monzon explains how we can use Paging 3 to deliver paged data to a Compose Multiplatform-based UI.

Resource Roundup

100% pure code!

GitHub: GerardPaligot / jsonforms-kotlin

JSON Forms is a spec for defining forms in a JSON Schema. Gérard Paligot (Mastodon, Bluesky) is working on a Compose Multiplatform renderer of JSON Forms, supporting Android, iOS, and desktop platforms.

GitHub: livekit / components-android

LiveKit “is an open source platform for developers building realtime media applications”, powered by WebRTC. The LiveKit team is working on composables to help render LiveKit content, such as rooms and tracks.

GitHub: stevdza-san / MessageBar-KMP

Stefan Jovanovic brings us a ContentWithMessageBar() composable for rendering success and error messages. This Compose Multiplatform library supports Android, iOS, desktop, and Web platforms.

GitHub: Lilytreasure / MultiplatformContacts

Dennis Wanja created a multiplatform pickMultiplatformContacts() launcher-style function to open up UIs for collecting contacts from the user, for iOS and Android.