Does the world need another cross-platform framework? Tough, this is JetBrains with Compose Multiplatform • The Register

An open source Kotlin framework for cross-platform applications, based on Jetpack Compose for Android, is now in the preview.

Google’s Jetpack Compose is an official framework for creating a user interface in an Android application and reached version 1.0 last week, at the same time as the first stable version of Android Studio, 2020.3.1 or “Arctic Fox”.

Even though Google has only just hit 1.0, said: “There are already over 2,000 apps in the Play Store that use Compose – in fact, the Play Store app itself uses Compose.”

Compose is a declarative framework that moves away from the traditional Android approach of a hierarchy or tree of layouts and controls. A Compose user interface is defined by writing functions annotated with the @Composable annotation that describe the screen state: The functions generate the user interface. “When the app status changes, your UI will update automatically, making it a lot easier to build the UI quickly,” said Google’s Android team.

Jetpack Compose for Android has just reached version 1.0

Jetpack Compose for Android has just reached version 1.0

Compose is a Kotlin framework, and both Kotlin and Android Studio (the official Android IDE) come from the developer tools company JetBrains. Although Jetpack Compose is Android-only (as opposed to Google’s Flutter framework), JetBrains believed Compose could be cross-platform as well. Create a multiplatform is a port of the framework for macOS, Linux, Windows and the web. Version 1.0 Alpha has just been released. Despite being an early version, JetBrains told us that it “provides robust APIs that developers should be sure to use”.

We asked Nikolay Igotti, Lead for Compose at JetBrains, why the company is investing in Compose for Desktop when it already has a cross-platform Java framework for desktop applications that is used in its IntelliJ IDEA IDE and its many flavors . “That’s pretty much swing with a few tweaks,” said Igotti. “Swing is the standard JDK UI framework, Swing and AWT (Abstract Windows Toolkit). Compose is a completely different framework, even though we offer interoperability … Swing is a pretty old framework that was released in the late 90s as they think about UI. “

A Compose for Desktop project in the JetBrains IDE

A Compose for Desktop project in the JetBrains IDE

Compose has one thing in common with Swing: it draws its own controls, as opposed to some cross-platform frameworks – such as Java’s SWT (Standard Widget Toolkit) or Microsoft’s Xamarin – which use native controls. Compose uses the Skia Open source graphics library also used by Google Chrome, Flutter, and many other frameworks. Does that mean a Compose application doesn’t have a native look and feel? “It’s up to the developers how they design their application,” said Igotti. “In that respect, it’s a similar situation to other frameworks like Flutter.”

Does a Compose for Desktop application depend on the JVM (Java Virtual Machine)? “We know that distributing a JVM application can be a little tricky,” Igotti told us. “We used our own Gradle plugin and this one jpackage and Jlink for building native applications from JVM applications. You get .dmg for Mac, MSI for Windows, .deb package for Linux, you don’t think about the JVM Kotlin / local Compiler that avoids this. “It will be used in the future or for desktop development,” said Igotti.

Compose for Desktop: a start

Compose for Desktop: a start

What about web applications? “We’ll take that Kotlin / JS Compiler, “Igotti said. The web version of Compose is not as advanced as the desktop version, and the documentation warns that” the API is not finalized and urgent changes are expected. “Model is the API is different and uses HTML and CSS, so less code can be shared with Compose for Desktop.

“Compose is a different way of thinking about applications,” said Igotti. “State is a source of truth to the user interface, and the user interface is stateless, it is always calculated from the state. In that regard, Compose is [for web] shares the same set of primitives, state management is shared. If you talk about the exact set of widgets how they’re arranged, they won’t be shared, “Igotti said.

What’s the main reason for Compose to expand from Android to these other platforms? “The target group for Compose are three groups of people. First up are Android developers using Kotlin and Compose who want to ship to other platforms. Third are people who are not familiar with Kotlin or Compose but want to create an attractive user interface. We want to give them the tools to do this easily. “

Igotti didn’t want to commit to any dates, but said he hopes a beta will be delivered “in mid-fall” and “we hope for 1.0 sometime this year”. The project is open source and “in the 21st century, it’s a common mindset that people don’t charge for frameworks,” said Igotti of the JetBrains business model based on the tools. “We want to create a missing piece of software,” he said.

Note that Compose does not have a visual designer. “Most vendors want to move away from graphical UI builders,” said Igotti, favoring a declarative UI and ways to preview it. “We provide a preview mechanism so that when you add a particular annotation to the Composable feature, it can be previewed without running the application.”

JetBrains believes desktop application developers are underserved, a view that is partly borne out by the company’s own developer surveys. “Desktop is like a second-class citizen to a lot of people … it seems like a niche that needs some attention.”

Will JetBrains use Compose for its own tools? One of them, JetBrains Toolbox (which manages installed IDEs), is already using Compose, but Igotti said there is too much legacy to expect to replace the existing framework for products like IntelliJ IDEA. “The most complex and important component is the editor, it has been in development for 20 years and it is very unlikely that it will be rewritten in the medium term. It is neither JetBrains nor my goal to force everyone to write in Compose. Our goal is it, to give those who need a better framework a chance to use it. “

We took a quick look at Compose for Desktop with the IntelliJ IDEA Community Edition and the basic tutorial: It all felt a bit new, but we managed to bring Hello World to the screen.

Does the world really need another cross-platform framework? Google’s Flutter, although primarily intended for mobile devices, is now also targeting the desktop as well as iOS, which Compose does not currently support. Flutter’s language is darts, however, and although darts use is increasing (mostly because of Flutter), it’s still less popular than Kotlin, according to the latest StackOverflow survey.

There’s evidence of momentum, with over 5,000 stars for the GitHub repository, and many reported issues: developers should expect some catches, but it’s a sign of activity. Compose has a distinctive approach to creating user interfaces and the best way to look at it is to give those who prefer this model thanks to its use for Android the option to target other platforms. ®

About Willie Ash

Check Also

Don’t commit yourself! Here are solid alternatives for Apple’s weaker software

One of the best things about Apple’s Macintosh computers is that they come with a …

Leave a Reply

Your email address will not be published.