Compose SwiftUIv0.10.0
esc
GuideAPIGitHub
Framework

Compose SwiftUI

Write SwiftUI screens in Kotlin with the Compose runtime, and keep your view models.

iOS 17.0+macOS 14.0+tvOS 17.0+watchOS 10.0+

Overview

Compose SwiftUI lets you write SwiftUI screens in Kotlin. It uses the Compose runtime, not Compose UI: your composables build a tree of SwiftUI views, and the app renders them with Apple's SwiftUI. Compose HTML does the same thing for the browser DOM.

Your Kotlin ViewModels, StateFlows and remember state work unchanged. You only rewrite the UI layer.

fun counterScreen() = composeSwiftUI {
    val vm = viewModel { CounterViewModel() }
    val count by vm.count.collectAsState()
    NavigationStack {
        VStack(spacing = 16.0, modifier = Modifier.navigationTitle("Counter")) {
            Image(systemName = SFSymbol.swift, modifier = Modifier.font(Font.largeTitle).foregroundStyle(Color.orange))
            Text("Count: $count", modifier = Modifier.font(Font.title))
            Button("Increment", action = vm::increment)
        }
    }
}
ComposeView { CounterScreenKt.counterScreen() }

Benchmarked against plain SwiftUI: 50 screens written twice, pixel-identical on macOS (50/50) and iOS (48/50), updates as fast as or faster than plain SwiftUI, mounting 8–18% slower; scenarios against Compose Multiplatform and native @Observable models. See Performance and docs/bench/RESULTS.md.

Production: Kotlin exceptions never terminate the app (an onError hook for your crash reporter), lifecycle, SavedStateHandle and rememberSaveable across process death, Swift package and CocoaPods distribution, ABI-checked releases with SemVer, SBOM and provenance. See Running in production, Versioning, Security and who uses it.

Documentation: the guide covers everything in 33 chapters, from installation and your first app to lists, navigation, animation, accessibility, every Apple framework integration, previews, performance and troubleshooting. Its Kotlin examples are compiled on every change (scripts/check_docs.py).

Frameworks

Topics

Browse all 3484 APIs · Read the guide · Kotlin-specific APIs