Kotlin Multiplatform for Mobile (KMP, also known as KMM) is JetBrains' official technology for sharing Kotlin code between Android and iOS applications while maintaining native UI on each platform. Unlike cross-platform frameworks that force a single UI paradigm, KMP focuses on sharing business logic, networking, data persistence, and domain layers while letting developers use native toolkits (Jetpack Compose on Android, SwiftUI/UIKit on iOS) for platform-specific experiences. As of 2026, KMP is production-ready and stable, with Compose Multiplatform enabling optional UI sharing across platforms. KMP eliminates code duplication without sacrificing native performance, and its incremental adoption path allows teams to migrate existing native apps module-by-module rather than rewriting from scratch.
What This Cheat Sheet Covers
This topic spans 20 focused tables and 204 indexed concepts, 111 flashcards. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
A jump-to index of every table row in this cheat sheet.
An interactive map of every table and concept in this topic.
Table 1: Core KMP Architecture Concepts
Everything in KMP starts with source sets — folders that decide which platforms a given chunk of Kotlin compiles to. The vocabulary here is the foundation for the rest of the sheet: commonMain holds the shared business logic, androidMain and iosMain plug in the platform-specific pieces, and expect/actual bridges the two. Grasp how these layers stack — plus the hybrid "shared logic, native UI" pattern most teams settle on — and the rest of KMP stops feeling like magic.
| Concept | Example | Description | |
|---|---|---|---|
src/commonMain/kotlin/// Shared business logic | • The shared codebase where platform-agnostic Kotlin code lives • Accessible to all targets • Contains networking, domain logic, repositories, ViewModels, and utilities • Compiles to all declared platforms | ||
src/androidMain/kotlin/// Android-specific code | • Android-specific implementation layer • Accesses Android SDK APIs directly • Provides actual implementations for Android platform• Compiled with Kotlin/JVM for Android targets | ||
src/iosMain/kotlin/// iOS-specific code | • iOS-specific implementation layer • Accesses iOS frameworks like UIKit and CoreData • Provides actual implementations for iOS platform• Compiled with Kotlin/Native to native iOS binaries | ||
shared/ (or composeApp/) | • The KMP library module containing common, Android, and iOS source sets • Generated as an .aar for Android and .framework/Swift Package for iOS• Defines shared targets in build.gradle.kts | ||
commonMain → iosMain → iosArm64Main | • Dependency chain of source sets • Child sets inherit code from parent sets • Enables incremental platform specificity • Default hierarchy template simplifies target configuration | ||
expect fun platform(): Stringactual fun platform() = "Android" | • Platform-specific API access from common code • expect declares API in commonMain• actual provides platform implementation in androidMain/iosMain• Compiler ensures all targets provide implementations | ||
import platform.UIKit.*val view = UIView() | • Direct access to iOS frameworks from Kotlin • Automatically generates Kotlin bindings for Objective-C/Swift APIs • Bidirectional interoperability • Uses cinterop definitions for C libraries | ||
Kotlin → Swift idiomatic APIs | • Kotlin-to-Swift direct export without Objective-C headers (enabled by default in Kotlin 2.1+) • Eliminates manual bridging • Exposes Kotlin classes, functions, and types idiomatically in Swift • Supports generics and suspend functions | ||
kotlin("multiplatform") version "2.1.0"targets { android(); iosArm64() } | • Configures multiplatform compilation in build.gradle.kts• Declares target platforms • Sets up source sets automatically • Manages platform-specific dependencies | ||
Business logic in commonMainUI: Jetpack Compose + SwiftUI | • Hybrid architecture that shares code without forcing UI uniformity • Networking, database, domain models, and repositories are shared • UI remains 100% native for platform fidelity • Most common KMP pattern in 2026 | ||
Shared UI across Android, iOS, desktop, web | • Optional cross-platform declarative UI framework built on Jetpack Compose • Enables sharing up to 100% of code including UI • Production-ready for mobile and desktop as of 2026 • Uses native rendering on each platform |