compose-multiplatform README

The project's README from github.com/JetBrains/compose-multiplatform. As one markdown file: README.md.

official project stable prerelease dev

Compose Multiplatform logo and name

Compose Multiplatform is a declarative framework for sharing UI code across multiple platforms with Kotlin. It is based on Jetpack Compose and developed by JetBrains and open-source contributors.

You can choose the platforms across which to share your UI code using Compose Multiplatform:

For example, you can share UIs between iOS and Android or Windows and MacOS.

Shared UIs of the iOS, Android, desktop, and web apps

iOS

Compose Multiplatform shares most of its API with Jetpack Compose, the Android UI framework developed by Google. You can use the same APIs to build user interfaces for both Android and iOS.

Since Compose is built on top of Kotlin Multiplatform, you can easily access native APIs, such as the Camera API, and embed complex native UI views, such as MKMapView.

Get started with Compose Multiplatform

Android

When Android is one of your targets, you get the same experience for Android as if you were developing an Android app using Jetpack Compose.

Get started with Compose Multiplatform

Desktop

Compose Multiplatform targets the JVM and supports high-performance hardware-accelerated UI rendering on all major desktop platforms – macOS, Windows, and Linux.

It has desktop extensions for menus, keyboard shortcuts, window manipulation, and notification management.

Get started with Compose Multiplatform

Web

Web support is in Beta, making it a great time to give it a try. Check out our blog post to learn more about the progress made to reach this milestone. We would appreciate your feedback on it in the public Slack channel #compose-web. If you face any issues, please report them on YouTrack.

You can experiment with sharing your mobile or desktop UIs with the web. Compose Multiplatform for web is based on Kotlin/Wasm, the newest target for Kotlin Multiplatform projects. It allows Kotlin developers to run their code in the browser with all the benefits that WebAssembly has to offer, such as good and predictable performance for your applications.

Get started with Compose Multiplatform for web

Libraries

Compose HTML

Compose HTML is a library targeting Kotlin/JS that provides Composable building blocks for creating web user interfaces with HTML and CSS.

Note that Compose HTML is not a multiplatform library. It can be used only with Kotlin/JS.

Learn more

Get help

There are dedicated public Slack channels for #compose-ios, #compose-desktop and #compose-web, as well as the general #compose channel.

If you encounter any issues, please report them on YouTrack.

compose-multiplatform (JetBrains/compose-multiplatform)

Searching Database…

这是什么?JetBrains 推出的一个声明式 UI 框架,构建在 Jetpack Compose 之上,用于在 Kotlin 中让同一套 UI 代码跨平台复用。
所以它基本上就是也能在 Android 之外运行的 Jetpack Compose?基本可以这么说:它的大部分 API 与 Google 的 Android UI 框架 Jetpack Compose 相同,所以你为 Android 和 iOS 写的是同一套 Compose 代码,不用为每个平台分别学一套 UI 系统。
搭建一个项目是什么样的?README 针对每个目标平台都链接了入门指南——iOS、Android、桌面端和网页端各有各的;项目使用标准的 Kotlin Multiplatform Gradle 工具链构建。
我得是 Android 开发者才能用它吗?你写的是 Kotlin,而 Android 部分的开发和 Jetpack Compose 开发完全一样。由于 API 是共享的,已有的 Compose 知识可以直接用到其他目标平台上。
网页端已经能用于生产环境了吗?不能——网页端明确处于 Beta 阶段,而 iOS、Android 和桌面端则标注为已可用。网页端的反馈通过 #compose-web Slack 频道收集,问题提交到 YouTrack。
一套 UI 代码能覆盖哪些平台?iOS、Android、桌面端(Windows、macOS 和 Linux)以及网页端。网页端是唯一仍标记为 Beta 的目标平台。
桌面端除了移动端的 UI 模型之外还提供了什么?它运行在 JVM 上,在 macOS、Windows 和 Linux 上具备高性能的硬件加速渲染,并增加了桌面端专属的扩展功能,比如菜单、键盘快捷键、窗口操作和通知管理。
我还能调用平台原生 API 吗,比如摄像头或原生地图视图?可以。Compose 构建在 Kotlin Multiplatform 之上,所以你可以访问 Camera API 等原生 API,并在共享 UI 中嵌入 MKMapView 这类复杂的原生 UI 视图。
网页端实际上是怎么运行我的代码的?Kotlin 通过 Kotlin/Wasm 编译成 WebAssembly,所以应用直接在浏览器里运行,享有 WebAssembly 的优势,比如良好且可预测的性能,而不是被改写成 JavaScript。
Compose HTML 是什么,它有什么不同?一个面向 Kotlin/JS 的独立库,为用 HTML 和 CSS 构建的网页 UI 提供 Composable 构建块。与 Compose Multiplatform 不同,它不是多平台的——只能在 Kotlin/JS 下使用。
What are similar projects?gkd, slint, Avalonia, flutter, animeko, uno, kotlin, ab-download-manager
Creator
JetBrains
Size
282.6 MB
Stars
19.4K
Age
6y
Commits · 90 Days