Introduction
Jetpack Compose isn't just for Android anymore. With Compose Multiplatform (CMP), you can write one UI codebase in Kotlin and run it across Android, iOS, and Desktop. In this first part of the series, we'll set up a CMP project using JetBrains' Kotlin Multiplatform Wizard and get it running on Desktop.
Step 1: Generate the Project
Go to Kotlin Multiplatform Wizard.
Select:
- ✅ Android
- ✅ iOS
- ✅ Desktop
- ✅ iOS UI = Compose
- ✅ Include Tests
Click "New Project", download, and open it in IntelliJ IDEA.
Your project will look like this:
shared/
└── src/
├── commonMain/ # shared UI + logic
├── androidMain/ # Android-specific
├── iosMain/ # iOS-specific
└── desktopMain/ # Desktop-specific
Step 2: Run on Desktop
In desktopMain/kotlin/Main.kt
you'll find:
1fun main() = application {2 Window(onCloseRequest = ::exitApplication) {3 Text("Hello, Compose Multiplatform!")4 }5}
Quick Tip: Select Desktop run config in IntelliJ.
▶ Run → Your first CMP app opens in a native window.
Ready for More? In Part 2, we'll start building a real app UI and share it across platforms.