Cross-platform: UI framework Compose Multiplatform has reached a stable level

Share your love

JetBrains has released version 1.0 of Compose Multiplatform. The framework uses the declarative approach of the Android UI toolkit Jetpack Compose and implements it across platforms for desktop, web and Android applications. Unsurprisingly, Kotlin is used as the programming language.

At the end of July, Google released the stable version 1.0 of Jetpack Compose. The UI toolkit for Android follows a declarative approach and relies on the Kotlin programming language and a reactive programming model. So-called composable functions define the individual control elements – or parts of them. Above @Composable Decorated functions can be nested in one another to ultimately create the surface. The code describes the basic appearance of the interface, and under the hood the toolkit takes care of the implementation in the tree structure of the UI and of updating the content.

Compose Multiplatform, which was launched as an alpha version in August, is now bringing the approach to the desktop and the web. So far, there was no UI toolkit for desktop applications with Kotlin, so developers had to fall back on Java UI frameworks. Thanks to the declarative approach, all UI elements at Compose are defined via the code. The following simple example from the JetBrains blog shows a text label that updates when a text field is changed:

var text by remember { mutableStateOf("Hello, World!") }
Column {
   Text(text) //text label
   TextField(text, {text = it}) //text field

A free plug-in for IntelliJ IDEA and Android Studio offers a live preview of the declared UI. It takes over changes in the code and shows their effects directly without a fresh build process and restart.

Read Also   Webinar: Malware and Ransomware - Risks and Defense

Google’s open source 2D graphics library Skia, which is used in Chrome, Firefox, Flutter, Android and LibreOffice, is used as the basis for the graphic display. It forms the interface to the platform-specific hardware acceleration, for example via DirectX or Metal.

Compose Multiplatform’s Gradle plug-in can create applications in Debian package format (.deb), as Windows installers (.msi), and as disk image files (.dmg).

The basis for web applications is Kotlin / JS. The framework provides an API to access the DOM and CSS-in-JS to generate CSS elements. In addition, it can process the SVG (Scalable Vector Graphics) format directly, among other things.

IntelliJ IDEA has had an assistant for Compose multiplatform projects on board since version 2021.1.

(Image: JetBrains)

Compose Multiplatform does not have an Android component, but according to JetBrains it uses the same APIs as Jetpack Compose, so that the code for the web and desktop components can be transferred directly to Android applications with Google’s UI framework. Conversely, developers can easily port declared UIs on the web and / or desktop to Compose Multiplatform with Jetpack Compose.

Further details can be found in the Refer to the JetBrains blog. Accordingly, the company has been using Compose Multiplatform for the Toolbox app for managing IDEs since the beginning of the year. on There are some tutorials on GitHubthat should help you get started with the framework.


Article Source

Share your love