JetPack Compose 1.2.0 was released this month (October 2022) with several new features and enhancements.
JetPack Compose 1.2 is the most powerful update yet to the new modern Android UI toolkit. It offers a wide range of new features and improvements to create beautiful & responsive user interfaces for your Android apps more accessible.
Today, within the post, we'll mention the new update of JetPack Compose 1.2.0. But, before proceeding, let's discuss JetPack Compose and why to use JetPack compose for creating android apps.
Android's suggested contemporary toolkit for creating native UI is Jetpack Compose. It expedites and streamlines Android UI development. You can quickly bring your project to life with less code, robust tools, and straightforward Kotlin APIs.
Why Use JetPact Compose for Building Android Apps?
Android's cutting-edge framework for developing native UI is called Jetpack Compose. It streamlines Android UI development, enabling you to create apps with less code, more potent tools, and comprehensible Kotlin APIs. It facilitates and speeds up the creation of Android UI.
Less Code
All phases of development are impacted by writing less code: as an author, you can concentrate on the issue at hand with fewer bugs to find and test; as a reviewer or maintainer, you have less code to read, comprehend, review, and maintain.
Compared to Android View, Compose can accomplish more with less code: There is less code to write today, so you can design buttons, lists, or animation.
Intuitive
You only need to specify your UI because Compose employs a declarative API; it takes care of the rest. The APIs are intuitive to understand and utilize.
You can create compact, stateless components that are not connected to any activity or fragment with Compose. They are thus simple to test and reuse.
Accelerate Development
Your current code is compatible with Compose; you can call Compose code from Views and Views from Compose. Most popular libraries, including ViewModel, Navigation, and Kotlin coroutines, are compatible with Compose, so you may start using it whenever you choose.
You can iterate and release code faster using the full Android Studio support and features like live previews.
Powerful
Compose gives you the power to make stunning apps with direct access to the Android platform APIs, built-in support for Material Design, Dark themes, animations, and more.
With Compose, it's quick and simple to build animations to give your apps motion and life.
Compose allows you to apply your desired design, creating with Material Design or your design system.
This is the reason why JetPack Compose is used in android app development. However, as mentioned above, the JetPack Compose 1.2.0 has already been released; therefore, it’s essential to know the new update with the experimental features.
Compose is still being used by developers to release code more quickly, such as the Twitter engineering team. A few words for Compose from a software engineer at Twitter.
Compose increased our productivity dramatically. It's much easier and faster to write a Composable function than to create a custom view, and it's also made it much easier to fulfill our designers' requirements.
In addition to supporting more recent versions of Kotlin, Compose 1.2 offers new stable APIs that have graduated from being experimental and include various enhancements for Compose on Phones, Tablets, and Foldables.
New Stable Features and APIs of JetPack Compose 1.2.0
Several new APIs and functionality are added as stable. Highlights consist of:
You can insert lists of items into a grid using the LazyHorizontalGrid and LazyVerticalGrid APIs. These APIs were present in Compose 1.1 but had the @ Experimental label.
To deal with the device's insets, the WindowInsets class has modifiers like windowInsetsPadding, systemBarsPadding, and windowInsetsTopHeight. This class, which replaces the Accompanist insets library as the primary mechanism for Insets, is firmly based on it.
The nested scroll is compatible with views, thanks to Modifier.nestedScroll. Here is an example showing how this new feature works. The documentation on gestures has more information.
The addition of easing curves makes it easier to create stunning animations quickly. Read our animation guidance for more information on how to utilize them.
By adding Modifier.pointerHoverIcon, PointerEventType.Scroll, and PointerEvent.scrollDelta mouse support was improved,
In the updated release of JetPack Compose 1.2.0, there are also a few experimental APIs.
Let's explore those-
New Experimental APIs
With LazyLayout, you may design your own unique, effective scrollable layouts. Use Modifier.overscroll to add unique overscroll effects to your scrollable container.
GoogleFont-based downloadable fonts. To begin, read the documentation.
Numerous text capabilities were introduced, including pluralStringResource, Brush APIs, and the ability to customize includeFontPadding and line heights (seeText docs).
Bottom Line
The new Jetpack Compose 1.2.0 update for Android app development brings several bug fixes, performance improvements, and new features to the platform. With this update, developers can now add inline input fields in their apps, create compostables that return multiple values, and more. If you're an Android app developer, check out the Jetpack Compose 1.2.0 update and see what it offers.