Newsletter Issue #97

Published: 2021-12-28

It’s the holiday season (in some parts of the world), so this newsletter is a bit short. But, we glance at a problem with Glance, learn how JetBrains applied Compose Multiplatform to their own Toolbox, and take a pair of deep dives into formatting the content of a TextField(). We also look at libraries for date selection and rendering chat/messaging UIs. And, I offer the obligatory end-of-year “review and preview” for 2021 and 2022.

One Off the Stack, One Off the Slack

You’ve got questions. That’s understandable!

How Do We Use String Resources with Glance?

Repeat after me: Glance is not Compose UI. Glance offers an API that resembles a tiny subset of Compose UI’s composables. And, if you mix Glance with Compose UI in a module, you may get very confused with your results. See how stringResource() plays into this in this week’s highlighted Stack Overflow question!

How Should We Add Space in Columns?

Do we use Spacer(), Arrangement.spacedBy(), or something else? The answers have nuance, as we see in this week’s highlighted Kotlinlang #compose Slack thread!

Composable Commentary

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

JetBrains Toolbox Case Study: Moving 1M users to Kotlin & Compose Multiplatform

Sebastian Aigner interviewed Victor Kropp for the Kotlin Blog, reviewing the use of Compose Multiplatform by JetBrains Toolbox. If you have not used Toolbox, it is a central control point for all of the JetBrains family of IDEs, including Android Studio. This involved a rewrite from an Electron-ish implementation (mixing HTML/CSS/JS with C++) to Compose for Desktop.

Medium: Filtering and modifying text input in Jetpack Compose way

Shreyas Patil is back, looking at how to apply VisualTransformation and OffsetMapping in lieu of outright replacing text for use with rendering formatted text in a TextField().

Medium: Hands on Jetpack Compose VisualTransformation to create a phone number formatter

Julien Salvi continues the theme, showing the use of VisualTransformation and OffsetMapping, in this case for formatting phone numbers in a TextField(), wrapping them (and Google’s phone number formatting library) up in a PhoneNumberVisualTransformation.

Medium: Managing Compose State Variable With And Without ViewModel

Elye returns, this time reviewing various options for where to place your State or MutableState values, covering the pros and cons of each. In particular, Elye focuses on which solutions support configuration changes and which solutions support state restoration (for short-term process termination).

Resource Roundup

100% pure code!

GitHub: Rafsanjani / datepickertimeline

Rafsanjani Aziz published a library with a DatePickerTimeLine() composable, for offering a scrolling row or column where the user can pick a date.

GitHub: SmartToolFactory / Flexible-Chat-Box

The Smart Tool Factory team released a pair of composables, ChatFlexBoxLayout() and SubcomposeColumn(), designed to make it easier to assemble a chat or messaging-style UI.

…And One More Thing

2021 is nearly over — at the very least, this is the last newsletter issue of the year.

2021 was pretty huge for Compose, in that we got the first stable release. That is a bit of a double-edged sword: we will get many more developers using Compose, but Compose UI itself is not a complete View system replacement. It may be close enough that some teams can implement their desired UI using Compose UI, but there will be teams that walk away disappointed.

2021 also helped to cement Compose as a useful framework beyond Android UIs. JetBrains plowed a lot of resources into Compose Multiplatform and how has stable versions of Compose for Desktop and Compose for Web. That, coupled with projects like Jake Wharton’s mosaic, CashApp’s molecule, and Google’s own Glance, illustrate the power of tree construction using composables.

What will 2022 bring? Some things seem fairly likely:

  • We should get one or two stable minor releases of Compose, starting with 1.1.0 early in the year

  • We should see a continued uptick in adoption, with follow-on effects like a significant rise in third-party libraries targeting Compose

  • Somebody will do something with Compose that we never expected

  • Compose complaints will continue, and many of the problems underlying those complaints will not get addressed in 2022

  • This newsletter will have 1+ issues 😁

2021 was a hard year for many. All I can hope is that your 2022 brings you good fortune, along with a fair number of functions annotated with @Composable.