- JetpackCompose.app Dispatch
- Posts
- JetpackCompose.app's Dispatch Issue #5
JetpackCompose.app's Dispatch Issue #5
š In today's issue, we discuss the Android connection to Wordle, creating presentations using Compose, running Android Studio on Android and @ComposableTarget
Whatās the status of the release?
Whatās the status of the release?
Whatās the status of the release?
Whatās the status of the release?
Tired of answering the same questions every time you ship an update?
GM Friends. This is JetpackCompose.appās Dispatch. The #1 Doctor recommended source for your weekly Android knowledge.
This is Issue # 5 and boy do we have a lot in store for you.
š„ Tipsy Tip
Ever found yourself needing to ensure a Composable slot in your function is strictly for side-effects, with no sneaky UI logic creeping in? Youāre not alone. Most developers rely on trust and a bit of divine intervention to ensure these components are used correctly. But we can do better than that, right?
Luckily, thereās a secret weapon in our toolkit: the @ComposableTarget("Empty")
annotation. This little gem ensures that your Composable function doesnāt emit any UI, making it perfect for side-effects. Hereās how you use it:
@Composable
fun MyCustomComponent(
effect: @Composable @ComposableTarget("Empty") -> ()
) {...}
This annotation acts as a safeguard, ensuring that only non-UI Composables are passed to your slot. Remember, for this to trigger a build error, youāll need to configure your Kotlin compile options to treat warnings as errors.
So, next time you need to keep your side-effects in check, ditch the divine intervention and leverage @ComposableTarget("Empty")
. Your code (and your sanity) will thank you!
š Dev Delight
š¤ Interesting tid-bits
I recently stumbled on a new project called CuP, which is a tool to build presentations using Jetpack Compose! It's a new tool that lets you build presentations directly in Jetpack Compose, and let me tell you, the results are impressive. Try it yourself with this demo link.
CuP offers smooth transitions, fun animations, multi-step slides, annotations and more. Imagine creating slides using Compose code! Hereās an example where the subtitle animates when you click once:
val title by Slide(
stepCount = 2
) { step ->
Text("Thank you for subscribing", fontSize = 24.sp)
AnimatedVisibility(visible = step >= 1) {
Text("I appreciate your trust!")
}
}
Iām genuinely considering using CuP for my next talk. It's a fantastic tool for anyone looking to add a unique, custom touch to their presentations.
Overview mode to view all your slides + steps in a single view
A new blog post on the Android Developers blog details the steps needed to add support for Predictive Back animation for screens using the classic View system. When I first read it, I thought it was a parody because it contains this monstrosity š¤Æ
This is absolutely bonkers! If you're an engineering manager, please ensure you're paying your Android developers more than their iOS counterpartsāthey work too hard dealing with stuff like this. Thankfully, itās a lot easier to manage in Compose.Not sure what to even add as a caption for this image
Ever wondered why we call them "bugs" and "debugging"? It turns out, we owe the term to Grace Hopper. While working on a Mark II computer at Harvard University, her team found a moth stuck in a relay, causing an issue. They logged it as the "First actual case of a bug being found." What started as a joke became a staple in our coding vocabulary. ~80 years later, weāre still blaming those pesky insects for our coding mistakes š
It seems you can now run Android Studio directly on your Android device š¤Æ! I havenāt tried it myself yet, but the video in this link looks promising. This setup allows you to build an Android app and run it on the same device.
The reason this is interesting to me is because for the last decade, Iāve wondered what the ideal UX might look like for programing on a mobile device. This development has rekindled my curiosity about that problem space. Have any of you tried coding on mobile? Any tools or setups you love? Iād love to hear your thoughts!Zach Klippenstein (who also happens to be our featured developer this issue) has been writing some seminal pieces about Compose state. He recently wrote a blog post diving deep into how
derivedStateof
works. Normally, I like to give the golden nuggets here in the newsletter, but this post is so comprehensive that it deserves to be read in its entirety. Check it out, and learn more about Zach in one of the sections below ā¬ļø
š„ Media Player
I found a hidden gem of a video recently, and a couple of minutes in, I was giddy with excitement because I knew it had to be in the next issue of Dispatch. Sharing these hidden gems is the whole point of writing this newsletter!
The video is from Figmaās annual conference, Config, and features a talk by Josh Wardle, the creator of Wordleāthe game that went super viral during the pandemic. Most people know that it was eventually acquired by The New York Times for a few million dollars, a great outcome for Josh. But hereās the kicker: Josh created the original prototypes of Wordle on Android in 2013 and then forgot about it for the next six years š¤Æ
The original prototype of Wordle on Android
During the pandemic, he picked it back up and built it for the web. One fascinating part of his talk was how, when he first built the prototype on Android, he kept stumbling on words he had never heard before, making the game less fun. To fix this, he created a mini game app for his partner where she would be presented with a word and she had to confirm if she knew the word. This reduced the word pool from 13,000 down to 2,500 5 letter words. This curated word list was eventually used in the final game that we all know and love and played a big role in itās success.
There are plenty more fun stories in the talk, so I highly, highly recommend watching it. Believe me, itās worth it!
š©āš» Featured Developer
This issueās featured developer is engineer extraordinaire Zach Klippenstein who works at Google on Jetpack Compose itself and Iāve had the honor of knowing him for the last few years.
Business in the day, party in the night š
The various moods of Zach
Whatās your favorite Android Studio shortcut?
Ctrl+J: Shows a popup with the rendered kdoc for the thing under the cursor. Itās the easiest way to view docs while coding, and also a quick way to verify your markdown formatting when writing kdoc.
What's your daily driver?
iPhone 15 Pro (š¤Ø)
Who's your programmer hero?
Writing code and building software is just a skill that can be learned. āHeroismā usually implies self-sacrifice for the greater good, which is not a scalable engineering practice nor a sustainable approach to work/life. That said, I think one of the most important programmers, historically, is Ada Lovelaceāthe first programmer.
If you were allowed only 3 apps on your phone, which apps would it be and why?
iMessage: To stay in touch with friends and colleagues and organize my social life.
Apple Music: Because life would be unbearably boring without music.
Safari: Almost everything can be done through a web browser.
One project that you feel most proud about shipping
I spent all of last year and the first part of this year working with Halil Ozercan to redesign and rewrite the BasicTextField component for Compose, and Iām pretty happy with how that turned out.
Whatās your favorite feature in Jetpack Compose
The snapshot system! Sometimes I write or talk about it.
š Let me hear it!
Whatād you think of this email? Tap your choice below and lemme hear it š
I hope you
Reply