Posted by Yasmine Evjen – Product Supervisor, and Florina Muntenescu – Developer Relations Engineer
Following its launch in July of 2023, Meta’s Threads grew to become probably the most quickly downloaded app ever with over 100 million downloads in its first week. Meta created the brand new text-based social media platform as a spot to construct connections and have significant conversations. To make sure the app was arrange for fulfillment at its launch and into the long run, Threads builders used Jetpack Compose, Android’s trendy declarative toolkit for constructing UI.
A neater method to construct UI with Jetpack Compose
Threads is constructed on high of current code from its sister app Instagram, which makes use of Views for its UI improvement. After constructive stories from different Android builders about Compose, and following inside testing and an evaluation of the toolkit’s advantages, Threads engineers opted to construct the all-new app from scratch utilizing Compose. By utilizing Compose, the staff might transfer quicker and higher put together the app for any future updates.
“We determined Jetpack Compose could be our goal UI framework going ahead,” mentioned Richard Zadorozny, a software program engineer at Threads. “We wished to construct the brand new app UI from scratch utilizing Compose as a result of it could allow us to maneuver quicker than refactoring a big software like Instagram.”
Despite the fact that most of Threads’ engineers had no prior expertise utilizing Compose, they discovered it straightforward to get began and study the brand new toolkit. With Compose, Threads engineers constructed and shipped the app in solely 5 months. This vastly exceeded the staff’s pace expectations for creating a high-quality Android software — particularly of this complexity and scale. The staff attributes a lot of this pace to the flexibleness and decoupling Compose offered.
Compose helped Threads engineers streamline the event of latest product options. The modular nature of the toolkit let Threads builders iterate on the app because it developed and teed up the app’s structure for future improvement. Compose additionally helped engineers construct user-friendly options that adhered to Materials Design tips.
Going all in with Compose
Threads engineers developed virtually all the app’s surfaces utilizing Compose. In the long run, they constructed over 90% of Threads utilizing Compose, together with the app’s exercise feed, navigation, search, profiles, onboarding web page, shared factor transitions, media viewer, settings, and extra.
Whereas Compose did largely every little thing Threads engineers wanted it to, it was nonetheless straightforward for them to interoperate with Views as vital. They used Views for Threads’ movies and the media picker that’s out there when creating a brand new publish.
Compose supplies trendy APIs that ship immediately with an app. Due to this, Threads engineers spent much less time worrying about backward compatibility, lacking options, or differing performance between completely different variations of Android. As a substitute, they may focus their vitality on creating a high-quality software.
“Compose’s design encourages a modular, plug-in strategy to improvement,” mentioned Richard. “Modifiers make all types of performance inherently reusable, so that you now not must subclass sophisticated ViewGroups or lump all types of logic into one place.”
The Threads staff used Modifiers for the app’s customized click on behaviors and its thread line illustration that seems on the left aspect of posts. Modifiers additionally allowed Threads builders to simply add the app’s branding to any components and ensured they have been correctly aligned on-screen.
Threads engineers additionally ensured the app was prepared for customers throughout platforms at launch. That meant ensuring Threads resizes to work on completely different units, like massive screens and foldables. The adaptive layouts Compose provides guarantee an app responds correctly to completely different display screen sizes, orientations, and kind components. This made it simpler for the Threads app to “simply work” for configuration adjustments, in keeping with Richard.
Compose is the ‘future’ of Android UI
Compose provided Threads builders a better method to design and create UI whereas making ready the app’s structure for the long run. With its intuitive composables and trendy declarative framework, Compose made end-to-end improvement easy and gave Threads builders confidence that updating the app could be straightforward.
Given the constructive outcomes the staff noticed with the discharge of Threads, Meta plans to broaden its use of Compose to a few of Instagram’s most vital surfaces, just like the app’s primary feed.
“It’s reached some extent the place Jetpack Compose can do virtually every little thing you’ll want, and its modular nature makes it straightforward to make a lot of the adjustments you would want to fill the gaps,” mentioned Richard. “I imagine Compose is the way forward for Android UI improvement, and it’s simply enjoyable!”
Get began
Optimize your UI improvement with Jetpack Compose.