Posted by Kseniia Shumelchyk, Android Developer Relations Engineer
Right this moment we’re launching model 1.0 of Compose for Put on OS, the primary steady launch of our trendy declarative UI toolkit designed to assist builders create lovely, responsive apps for Google’s smartwatch platform.
Compose for Put on OS was constructed from the underside up in Kotlin with assumptions of contemporary app structure. It makes constructing apps for Put on OS simpler, sooner, and extra intuitive by following the declarative strategy and providing highly effective Kotlin syntax.
The toolkit not solely simplifies UI growth, but in addition offers a wealthy set of UI elements optimized for the watch expertise with built-in help of Materials design for Put on OS, and it’s accompanied by many highly effective instruments in Android Studio to streamline UI iteration.
What this implies
The Compose for Put on OS 1.0 launch implies that the API is steady and has what you should construct production-ready apps. Shifting ahead, Compose for Put on OS is our beneficial strategy for constructing person interfaces for Put on OS apps.
Your suggestions has helped form the event of Compose for Put on OS; our developer neighborhood has been with us every step of the way in which, participating with us on Slack and offering suggestions on the APIs, elements, and tooling. As we’re engaged on bringing new options to future variations of Compose for Put on OS, we’ll proceed to welcome developer suggestions and solutions.
We’re additionally excited to share how builders have already adopted Compose of their Put on OS apps and what they like about it.
What builders are saying
Todoist helps folks manage, plan and collaborate on tasks. They’re one of many first firms to fully rebuild their Put on OS app utilizing Compose and redesign all screens and interactions:
“When the brand new Put on design language and Compose for Put on OS have been introduced, we have been thrilled. It gave us new motivation and alternative to speculate into the platform.”
Counting on Compose for Put on OS has improved each developer and person expertise for Todoist:
“Compose for Put on OS helped us tremendously each on the event aspect and the design aspect. The guides and documentation made it simple for our product designers to arrange mockups matching the brand new design language of the platform. And the libraries made it very simple for us to implement these, offering all the required widgets and customizations. Swipe to dismiss, TimeText, ScalingLazyList have been all elements that labored very effectively out-of-the-box for us, whereas nonetheless permitting us to make a recognizable and distinct app.”
Outdooractive helps folks plan routes for climbing, biking, operating, and different out of doors adventures. As wearables are a key facet of their product technique, they’ve been fast to replace their providing with an app for the person’s wrist.
Outdooractive has already embraced Put on OS 3, and by migrating to Compose for Put on OS they aimed for developer-side advantages akin to having a contemporary code base and elevated growth productiveness:
“Enormous enchancment is how lists are created. Because of ScalingLazyColumn it’s simpler (in comparison with RecyclerView) to create scrolling screens with out losing sources. Availability of normal elements like Chip helps saving time by with the ability to use pre-fabricated design-/view-components. What would have taken us days now takes us hours.”
The Outdooractive crew additionally highlighted that Compose for Put on OS utilization assist them to try for higher app high quality:
“Improved animations have been a pleasant shock, permitting easily hiding/revealing elements by simply wrapping elements in “AnimatedVisibility” for instance, which we utilized in locations the place we might usually not have invested any time in implementing animations.”
One other developer we’ve been working with, Interval Tracker helps preserve observe of interval cycles, ovulation, and the possibility of conception.
They’ve taken benefit of our UI toolkit to considerably enhance person interface and shortly develop new options out there solely on Put on OS:
“Compose for Put on OS offered us with many kits to assist us deliver our designs to life. For instance, we used Chips to design the principle buttons for interval recording, water consuming, and taking treatment, and it additionally helped us create a novel search for the most recent model of Kegel exercise.”
Equally to different builders, Interval Tracker famous that Compose for Put on OS helped them to attain higher developer expertise and improved collaboration with design and growth groups:
“For instance, earlier than Chips elements have been out there, we had to make use of a customized technique to load photographs on buttons which brought on a whole lot of adaptation work. Sure, Compose for Put on OS improved our productiveness and made our designers extra keen to design a greater person expertise on wearables.”
Take a look at the in-depth case research to be taught extra about how different builders are utilizing Jetpack Compose.
Let’s look into the important thing options out there with 1.0 launch:
- Materials: The Compose Materials catalog for Put on OS already provides extra elements than can be found with View-based layouts. The elements observe materials styling and likewise implement materials theming, which lets you customise the design to your model.
- Declarative: Compose for Put on OS leverages Fashionable Android Growth and works seamlessly with different Jetpack libraries. Compose-based UIs usually end in much less code and speed up the event course of as an entire, learn extra.
- Interoperable: When you’ve got an present Put on OS app with a big View-based codebase, it is potential to steadily undertake Compose for Put on OS by utilizing the Compose Interoperability APIs slightly than having to rewrite the entire codebase.
- Handles totally different watch shapes: Compose for Put on OS extends the muse of Compose, including a DSL for all curved components to make it simple to develop for all Put on OS machine shapes: spherical, sq., or rectangular with minimal code.
- Efficiency: Every Compose for Put on OS library ships with its personal baseline profiles which are routinely merged and distributed together with your app’s APK and are compiled forward of time on machine. Generally, this achieves app efficiency for manufacturing builds that’s on-par with View-based apps. Nevertheless, it’s vital to know configure, develop, and take a look at your app’s efficiency for the very best outcomes. Be taught extra.
Observe that utilizing model 1.0 of Compose for Put on OS requires utilizing the model 1.2 of androidx.compose libraries and due to this fact Kotlin 1.7.0. Learn extra about Jetpack Compose 1.2 launch right here.
Instruments and libraries
The declarative paradigm shift additionally alters the event workflow. The Compose tooling out there in Android Studio will enable you construct apps extra productively.
Android Studio Dolphin features a new challenge template with Compose for Put on OS that will help you get began.
The Composable Preview annotation permits you to immediately confirm how your app’s format behaves on totally different watch sizes and shapes. You may configure the machine preview to point out totally different Put on OS machine varieties (spherical, rectangle, and many others):
Beginning with Android Studio Electrical Eel, Reside Edit helps iterative code growth for Put on OS, offering fast suggestions as you make adjustments within the editor and instantly reflecting UI within the Preview or operating app on the machine.
Horologist is a gaggle of open-source libraries from Google that complement Put on OS growth, which we introduced with the beta launch of Compose for Put on OS. Horologist has graduated various experimental APIs to steady together with TimeText fadeAway modifiers, WearNavScaffold, the Date and Time pickers.
To be taught extra about Compose for Put on OS take a look at:
Now that Compose for Put on OS has reached its first steady launch, it’s time to create lovely apps constructed for the wrist with Compose!
Be part of the neighborhood
Be part of the dialogue within the Kotlin Slack #compose-wear channel to attach with the crew and different builders and share what you’re constructing.
Please preserve offering us suggestions on the situation tracker and tell us your expertise!
For extra details about constructing apps for Put on OS, take a look at the developer website.