Skills2026年5月12日·1 分钟阅读

Compose Multiplatform — Kotlin UI for Desktop, iOS & Web

Build rich user interfaces for Android, iOS, desktop, and web from a shared Kotlin codebase using JetBrains' declarative Compose UI toolkit.

Agent 就绪

这个资产可以被 Agent 直接读取和安装

TokRepo 同时提供通用 CLI 命令、安装契约、metadata JSON、按适配器生成的安装计划和原始内容链接,方便 Agent 判断适配度、风险和下一步动作。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
Compose Multiplatform
通用 CLI 安装命令
npx tokrepo install d7b6d7da-4e1e-11f1-9bc6-00163e2b0d79

Introduction

Compose Multiplatform is JetBrains' extension of Jetpack Compose that enables developers to share declarative UI code across Android, iOS, desktop (Windows, macOS, Linux), and web from a single Kotlin codebase. It brings the same reactive Compose programming model that Android developers already know to every major platform.

What Compose Multiplatform Does

  • Shares UI logic and composable functions across Android, iOS, desktop, and browser targets
  • Provides a Kotlin-native rendering engine on each platform for smooth 60fps performance
  • Integrates tightly with Kotlin Multiplatform (KMP) for sharing business logic alongside UI
  • Offers interoperability with SwiftUI on iOS and native widgets where needed
  • Supports Gradle-based build configuration with per-platform source sets

Architecture Overview

Compose Multiplatform builds on the Compose compiler plugin and runtime from Jetpack Compose. On Android it delegates to the standard Compose runtime. On desktop it uses Skia via Skiko for GPU rendering. On iOS it renders through a Skia canvas embedded in UIKit. The web target compiles Kotlin to JavaScript or Wasm and draws to an HTML5 Canvas. Shared composables run identically; platform-specific code is isolated in expect/actual declarations.

Self-Hosting & Configuration

  • Use the Kotlin Multiplatform wizard at kmp.jetbrains.com to scaffold a project with desired targets
  • Configure targets in build.gradle.kts under the kotlin multiplatform block
  • Add Compose Multiplatform dependencies via the JetBrains Compose Gradle plugin
  • Set up iOS builds through Xcode integration using the Kotlin/Native framework export
  • Customize themes and typography using MaterialTheme or build a custom design system

Key Features

  • Declarative UI paradigm with composable functions, state management, and recomposition
  • Full Material 3 component library available across all targets
  • Live preview in IntelliJ IDEA and Android Studio for rapid iteration
  • Navigation and lifecycle-aware components shared across platforms
  • Resource management system for images, fonts, and strings that works cross-platform

Comparison with Similar Tools

  • Jetpack Compose — Android-only; Compose Multiplatform extends it to iOS, desktop, and web
  • Flutter — Dart-based with its own rendering engine; CMP uses Kotlin and the JetBrains ecosystem
  • React Native — JavaScript-based bridge to native views; CMP compiles to native code
  • SwiftUI — Apple-only; CMP targets Android and desktop in addition to iOS
  • Avalonia — .NET/XAML-based; CMP is Kotlin-native and leverages the Kotlin Multiplatform ecosystem

FAQ

Q: Is Compose Multiplatform production-ready for iOS? A: iOS support has reached stable status as of Compose Multiplatform 1.6+. Many production apps ship with it today.

Q: Can I mix native platform UI with shared Compose screens? A: Yes. You can embed Compose views inside SwiftUI or UIKit on iOS and use platform-specific composables via expect/actual.

Q: Does it require IntelliJ IDEA or Android Studio? A: Android Studio or IntelliJ IDEA with the Kotlin Multiplatform plugin is recommended. Fleet also supports CMP projects.

Q: How does performance compare to native UI? A: The Skia-based renderer delivers near-native frame rates. On Android it uses the standard Compose runtime with no additional overhead.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产