Sharing UI with Compose Multiplatform
From shared logic to shared UI
So far we’ve shared everything below the UI. Compose Multiplatform (by JetBrains, built on Jetpack Compose) takes it further: you can write your screens once in Compose and run them on Android, iOS, desktop and web.
A shared screen
@Composable
fun App() {
var count by remember { mutableStateOf(0) }
MaterialTheme {
Column(
modifier = Modifier.fillMaxSize().padding(16.dp),
horizontalAlignment = Alignment.CenterHorizontally
) {
Text("Clicks: $count")
Button(onClick = { count++ }) { Text("Tap me") }
}
}
}
This exact composable renders on every platform — the same UI, drawn by Compose’s engine, not translated to native widgets.
How each platform shows it
- Android — call
App()insidesetContent { }as usual. - iOS — Compose Multiplatform provides a
UIViewControllerwrapper you embed in your SwiftUI/UIKit app. - Desktop / Web — small entry points host the same
App().
When to share UI vs go native
- Share UI (Compose Multiplatform) — great for internal tools, content apps, MVPs, and small teams who want maximum reuse and speed.
- Native UI (SwiftUI on iOS) — better when you need the exact platform feel, the newest OS UI features, or deep platform integration. Common for consumer apps where iOS users expect a true iOS look.
You can even mix: share most screens but build a few critical ones natively.
Maturity
Compose Multiplatform is stable for Android, desktop and iOS, with web steadily maturing. iOS support is production-ready and improving rapidly — many teams ship with it today.
The spectrum of sharing
It helps to see KMP as a dial, not a switch:
- Share models + networking only (most conservative).
- Add repositories + business logic.
- Add ViewModels / presentation.
- Add UI with Compose Multiplatform (most aggressive).
Pick the point on the dial that fits your team and product.
Common mistakes
- Sharing the UI before the logic layer is solid — share logic first.
- Forcing shared UI on iOS when users expect a fully native feel.
- Treating it as all-or-nothing instead of choosing a level of sharing.
Summary: Compose Multiplatform lets you share whole screens across platforms, not just logic. Think of KMP as a dial — share models, then logic, then ViewModels, then optionally UI — and choose native UI on iOS when the platform feel matters most.