JetBrains Compose for Desktop and Web is now in alpha
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 lets developers create their layouts and accompanying logic all in Kotlin. JetBrains, the company behind Kotlin, also got in on the Compose action and is working on porting it to both desktop and the web.
JetBrains Compose for Desktop and Web has been in development for a while now. It’s had a public pre-alpha “Technology Preview” that developers can use to create cross-platform apps in Compose. I’ve personally used it for my Samsung Firmware Downloader app, and it works pretty well.
Today, JetBrains is promoting its version of Compose to alpha. That means a more stable API, along with some new features and changes.
Compose for Web
First up, the web. Compose for Web is even newer than Compose for Desktop, and it’s missing quite a bit. That doesn’t mean it’s useless, though. While developers may not get the fancy core UI elements available for Desktop and Android, developers do still get the benefits of writing in Kotlin with declarative design principles.
Now that Compose is in an alpha stage, the Web API should be more stable, with fewer, if any, breaking changes made over time.
Compose Window Management
Back to Desktop, there are some changes to how developers interact with windows in their app.
The first is a new composable window API. This lets developers interact with the windows in their app in declaratively. For example, the 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 lets developers choose to have new windows open with an adaptive (instead of fixed) size. This means that Compose will calculate how big a window needs to be based on its content, automatically set the initial size, and then open the window.
Plugins
JetBrains Compose has always had a Gradle plugin to perform compilation and execution. With the alpha, this plugin is getting a version bump, along with some bug fixes.
On top of the Gradle plugin, though, there’s now an IDE plugin for IntelliJ IDEA and Android Studio to better support Compose for Desktop and Web. Similarly to Compose for Android, this plugin lets developers annotate composable functions as previews and view layout previews directly in the IDE.
The plugin is very basic right now. The only other feature it has right now removes the IDE lint warning about using title case for composable function names. But it’s going to get more features as time goes on, such as live preview.
Architecture Support
Even though the goal for JetBrains Compose is to be cross-platform, it doesn’t quite have full support for all CPU architectures yet. The alpha expands the current support to the following:
- macOS: x86-64 (amd64), arm64
- Windows: x86-64 (amd64)
- Linux: x86-64 (amd64), arm64
- Web: anything recent
While that certainly doesn’t cover everything out there, support is only going to get better in the future.
Future Developments
JetBrains’ choice to move Compose into an alpha state is important. It means that they’re planning to continue developing for it, with eventual beta and stable stages. And, of course, more features.
Conclusion
It’s pretty exciting to see what Compose has to bring. On Android, it replaces an outdated (although perfectly usable) layout engine. On Desktop and Web, it brings declarative design using a strongly-typed language that’s easier to use (at least for me) than TypeScript-based languages. Especially on Desktop, Compose helps to fill a pretty large gap for functional layout engines.
If you’re interested in trying out JetBrains Compose yourself, check out the GitHub repository for more details on how to get started.
The post JetBrains Compose for Desktop and Web is now in alpha appeared first on xda-developers.
from xda-developers https://ift.tt/3lvbXiD
via IFTTT
Aucun commentaire: