Does the world need another cross-platform framework? Tough, here’s JetBrains with Compose Multiplatform • The Register


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

Google’s Jetpack Compose is an official framework for building a user interface into an Android application, and reached version 1.0 last week, along with the first stable release of Android Studio, 2020.3.1 or “Arctic Fox”.

Although it only hit 1.0, Google said, “There are already over 2,000 apps in the Play Store using Compose – in fact, the Play Store app itself uses Compose.”

Compose is a declarative framework that departs 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, which describe the state of the screen: the functions generate the user interface. “As the state of the app changes, your UI automatically updates, which makes it much easier to build the UI quickly,” the Google Android team said.

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 Kotlin and Android Studio (the official Android IDE) come from developer tools company JetBrains. Although Jetpack Compose is only Android (unlike Google’s Flutter framework), JetBrains believed Compose could be cross-platform as well. Compose Multiplatform is a port of the framework for macOS, Linux, Windows and Web. Version 1.0 Alpha has just been released. Although this is a first release, JetBrains told us that it “provides stable APIs that developers should already be able to use safely.”

We asked Nikolay Igotti, Head of Compose at JetBrains, why the company is investing in Compose for Desktop when it already has a cross-platform Java framework for desktop applications, used in its IDE IntelliJ IDEA and its many variations. “It’s pretty much Swing with a few modifications,” Igotti said. “Swing is the default JDK UI framework, Swing and AWT (Abstract Windows Toolkit). Compose is a completely different framework, although we provide interoperability… Swing is a fairly old framework, released in the late 90s, since then people have changed the way they think about the user interface. “

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, unlike some cross-platform frameworks – Java’s SWT (Standard Widget Toolkit) or Microsoft’s Xamarin, for example – which use native controls. Compose uses the open source Skia graphics library, which is also used by Google Chrome, Flutter, and many other frameworks. Does this mean that a Compose app won’t look native? “It’s up to the developer to decide how they thematize their application,” Igotti said. “It’s a similar situation to other frameworks like Flutter in this regard.”

Does a Compose for Desktop application depend on the JVM (Java Virtual Machine)? “We realize that distributing a JVM application can be a bit tricky,” Igotti told us. “We have our own Gradle plugin and it uses jpackage and Jlink to build native apps from JVM apps. You get .dmg for Mac, MSI for Windows, .deb package for Linux, you don’t think about JVM. “That said, it’s a JVM application under the covers, although there is a Kotlin / Native compiler that avoids that. “It will be used in the future or for desktop development,” Igotti said.

Compose for Desktop: a start

Compose for Desktop: a start

What about web applications? “We use the Kotlin / JS compiler,” Igotti said. The web version of Compose is not as advanced as the desktop version, and the documents warn that “the API is not finalized and significant changes can be expected.” Also, although the web version uses the Compose template, the API is different and uses HTML and CSS, so less code can be shared with Compose for Desktop.

“Composing is a different way of thinking about apps,” Igotti said. “State is a source of truth for the user interface, and the user interface is stateless, it is always calculated from the state. In this regard, Compose [for web] shares the same set of primitives, state management is shared. If you’re talking about the exact set of widgets, the way they’re organized, it’s not shared, ”Igotti said.

What is the main driver behind expanding Compose from Android to these other platforms? “Compose’s target audience is made up of three groups of people. The first is Android developers using Kotlin and Compose who want to deliver on other platforms. Another is from Kotlin developers who want to write new apps that ‘write once, run anywhere’. Third, people who are new to Kotlin or Compose but want to create an engaging user interface, we want to give them the tools to do it easily. “

Igotti didn’t want to commit to any dates, but said he hoped a beta release would be delivered “mid-fall” and “we’re hoping for a 1.0 this year”. The project is open source and “it’s a general attitude in the 21st century that people don’t charge for frameworks,” said Igotti, with the JetBrains business model based on tooling. “We want to create missing software,” he said.

Note that Compose does not have a visual designer. “Most vendors want to move away from graphical user interface builders,” Igotti said, in favor of a declarative user interface and ways to preview that. “We provide a preview mechanism so that if you put some annotation on the composable feature, it can be previewed without running the app.”

JetBrains considers desktop application developers to be underserved, an opinion partly informed by the company’s own development surveys. “The office 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), already uses Compose, but Igotti said there is too much legacy to expect it to replace the existing framework for products. like IntelliJ IDEA. “The most complex and important component is the editor, it’s been in development for 20 years and it’s very unlikely to be rewritten in the medium term. It’s not JetBrains or my goal to force everyone to write in Compose. Our goal is to give those who need a better framework a chance to use it. “

We took a quick look at Compose for Desktop using the IntelliJ IDEA Community Edition and the Basic Tutorial – it all seemed a bit cutting edge, but we managed to bring Hello World to the screen.

Does the world really need another cross-platform framework? Google’s Flutter, while primarily aimed at mobile, is now also targeting the desktop, as well as iOS, which Compose does not currently support. Flutter’s language is Dart, however, and while Dart usage is on the rise (mostly because of Flutter), it’s still less popular than Kotlin, according to the latest StackOverflow survey.

There is evidence of momentum, with over 5,000 stars for the GitHub repository and plenty of issues reported: Developers should expect a few hiccups but it’s a sign of activity. Compose has a distinctive approach to UI creation and perhaps the best way to look at it is that for those who prefer this model through its use for Android, the ability to target other platforms will be the one. Welcome. ®

Leave A Reply

Your email address will not be published.