JetBrains Compose for Desktop and Web is now in alpha version



[ad_1]

If you haven’t heard of Jetpack Compose, where have you been lately? Google created this declarative UI framework to replace the standard XML layout engine in Android. Compose allows developers to create their layouts and accompanying logic in Kotlin. JetBrains, the company behind Kotlin, has also participated in the Compose action and is working on porting it both to the desktop and to the web.

JetBrains Compose for Desktop and Web has been in development for quite some time. It has a pre-alpha public “Tech Preview” that developers can use to build cross-platform applications in Compose. I have personally used it for my Samsung Firmware Downloader app, and it works pretty well.

Today, JetBrains is promoting its alpha version of Compose. This means a more stable API, as well as new features and changes.

Compose for the web

First of all, the Web. Compose for Web is even newer than Compose for Desktop, and it lacks a bit. That’s not to say it’s unnecessary, however. While developers might not get the basic UI elements available for Desktop and Android, developers still get the benefits of writing in Kotlin with declarative design principles.

Now that Compose is in an alpha phase, the web API should be more stable, with fewer, if any, significant changes over time.

Managing the composition window

Back in the office, there are a few changes to the way developers interact with windows in their application.

The first is a new Composable Window API. This allows developers to interact declaratively with the windows of their application. For example, window title can now be changed with a state, and windows can even be opened and closed based on states.

Another part of the new Window API allows developers to choose to open new windows with adaptive size (instead of fixed). This means that Compose will calculate the size of a window based on its contents, automatically set the initial size, and then open the window.

Plugins

JetBrains Compose has always had a Gradle plugin to do the compilation and execution. With the alpha, this plugin gets a bump version, as well as some bugfixes.

In addition to the Gradle plug-in, there is now an IDE plug-in for IntelliJ IDEA and Android Studio to better support Compose for Desktop and Web. Similar to Compose for Android, this plugin allows developers to annotate composable features as previews and display layout previews right in the IDE.

The plugin is very basic at the moment. The only other feature it currently has is removing the lint IDE warning about using title case for composable function names. But it’s going to have more features over time, like live preview.

Architecture support

While the goal of JetBrains Compose is to be cross-platform, it does not yet fully support all processor architectures. Alpha expands current support to include the following:

  • macOS: x86-64 (amd64), arm64
  • Windows: x86-64 (amd64)
  • Linux: x86-64 (amd64), arm64
  • Web: nothing recent

While it certainly doesn’t cover everything, support will only get better in the future.

Future developments

The choice of JetBrains to move Compose into an alpha state is important. This means that they plan to continue developing for it, with possible beta and stable milestones. And, of course, more features.

Conclusion

It’s pretty exciting to see what Compose has to offer. On Android, it replaces an outdated (although perfectly usable) layout engine. On Desktop and Web it brings declarative design using strongly typed language which is easier to use (at least for me) than TypeScript based languages. Especially on Desktop, Compose helps fill a big enough gap for functional layout engines.

If you’d like to try JetBrains Compose yourself, check out the GitHub repository for more details on how to get started.

[ad_2]

Source link