jetc.dev Newsletter Issue #246

Published: 2024-12-24

We got a final(?) Compose Multiplatform release for 2024!

Beyond that, we explore type-safe navigation and its challenges. We look at a catalog of libraries and how hot reload works. And we peek at an IDE plugin to build @Preview functions.

Ooooo… What Did We Get?

Reviewing the release notes for the latest Jetpack Compose update!

JetBrains could have left things alone until 2025. Instead, they went ahead and released Compose Multiplatform 1.7.3, with some dependency updates and bug fixes.

One Off the Stack, One Off the Slack

You’ve got questions. That’s understandable!

Why Is My NavType Not Found?

Compile-time type safety only works if everything is compiled and referenced directly. Navigation for Compose in this regard is only partially type safe, in that custom NavType implementations might compile and be referenced but not work at runtime. Learn how to overcome this in this week’s highlighted Stack Overflow question.

How Can I Use Type-Safe Parameters Across Nav Graphs?

Continuing the Navigation for Compose theme… if a series of screens in a sub-graph need type-safe parameters, how do they get them? That is especially confusing if multiple screens in the sub-graph need to be independent nav targets (i.e., another screen can link to any of those sub-graph screens). Learn more about the problem and an implementation in this week’s highlighted Kotlinlang #compose Slack thread.

Composable Commentary

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

What’s new in CameraX 1.4.0 and a sneak peek of Jetpack Compose support

Google’s Scott Nien explains the changes coming in the Jetpack camera library, including a new CameraXViewfinder() composable for rendering a preview.

Introducing klibs.io: A New Way to Discover Kotlin Multiplatform Libraries

JetBrains’ Ekaterina Petrova writes about klibs.io, a new library catalog site, this one focusing on Kotlin Multiplatform. It includes a few dozen Compose Multiplatform libraries at present.

Say Hello to ‘Compose Hot Reload’ (Firework)

JetBrains’ Sebastian Sellmair (Mastodon, Bluesky) outlining the in-progress Compose Hot Reload capability, including many demos of what it can reload (answer: just about anything). Sebastian goes on to explain in some detail how it all works.

Medium: Localization in Compose — The pragmatic way

Anand Bose (Mastodon, Bluesky) outlines an approach for handling internationalization and localization in a Compose project, leveraging composition locals to seamlessly handle language changes throughout a code base.

Medium: Feature-Based Folder Structure in Jetpack Compose: Best Practices

hoseinali alborzi recommends a specific package naming structure, revolving around a features package that contains UI, data, and domain sub-packages.

Medium: Creating Web Demos for Compose Multiplatform Apps

Mirzamehdi Karimov (Mastodon) walks us through using the KMPDevicePreview library to create Web demos powered by Kotlin/Wasm.

Medium: Reverse-Engineering the Compose Compiler Plugin: Intercepting the Frontend

Amanda Hinchman (Mastodon) looks at some of the Compose Compiler magic, showing us the plugin’s implementation and showing us how it integrates into the compiler and performs some of that magic.

Medium: A Shrinking Text Composable — Or: How to animate the font weight

Christian Hansen wanted to animate the weight of a font, going from thin to bold weights. This was accomplished by using a tween() animatedFloat and lerp() to interpolate between start and end weights.

Resource Roundup

100% pure code!

Gist: riggaroo / KeyframesWithSpline.kt

Google’s Rebecca Franks (Mastodon, Bluesky) is back with another code snippet, this one demonstrating the use of the new keyframesWithSpline() animation builder.

GitHub: markst / expandable-player-kt

Mark Turner brings us an expandable() modifier, backed by ExpandableSettings and MinimizeHandler, to support UIs akin to SoundCloud’s mini media player.

GitHub: EarlOfEgo / Jetpack-Compose-preview-creator

Stephan Hagios created a plugin for Android Studio and IntelliJ IDEA that provides a code generator to create a @Preview function for a composable.

GitHub: zakgof / compose-table

Oleksandr Zakusylo implemented a Compose Multiplatform Table() widget, which works like TableLayout in the classic view system, with Row() composables defining the cells for each row.

Notable Releases

Voyager is up to 1.0.1, with a bug fix.

…And One More Thing

Merry Christmas, to those who celebrate!