A practical guide to Kotlin Multiplatform (KMP) — share business logic across Android, iOS, desktop, and web while keeping native UIs and performance.
Target versions: Kotlin 2.4.x with the K2 compiler, Ktor 3.x, kotlinx.serialization 1.8.x, SQLDelight 2.1.x, Koin 4.x, and Compose Multiplatform 1.11.x.
After completing this guide, you will be able to:
- Create and structure a KMP project with the Kotlin Multiplatform wizard
- Share code with
expect/actualand platform-specific implementations - Build a shared networking layer with Ktor and kotlinx.serialization
- Persist data offline with SQLDelight across platforms
- Set up dependency injection with Koin Multiplatform
- Share UI with Compose Multiplatform on Android, iOS, and desktop
- Ship a complete cross-platform library with a clean public API
| Section | Topic | File |
|---|---|---|
| KMP Fundamentals | Project Setup and Structure | 01-kmp-fundamentals/01-kmp-project-setup.md |
| Common vs Platform Code (expect/actual) | 01-kmp-fundamentals/02-common-vs-platform-code.md | |
| Shared Modules | Shared Networking with Ktor | 02-shared-modules/03-shared-networking.md |
| Shared Persistence with SQLDelight | 02-shared-modules/04-shared-persistence-sqldelight.md | |
| Cross-Platform DI | Koin Multiplatform | 03-cross-platform-di/05-koin-multiplatform.md |
| Compose Multiplatform | Shared UI with Compose | 04-compose-multiplatform/06-compose-multiplatform-ui.md |
| Workshop | Build a Weather Library | 99-workshop/01-cross-platform-library-workshop.md |