Kotlin Multiplatform Cheat Sheet
|
This content was generated with the assistance of AI and should be verified against the official Kotlin Multiplatform documentation before being relied on in production. See the section bibliography for the reference material consulted while preparing these pages. |
A single-page, colour-coded summary of the Kotlin Multiplatform essentials targeting Kotlin 2.4.20, Compose
Multiplatform 1.12.1 and the Android Gradle Plugin 9.4 — what to share and each platform’s stability, compilers,
targets and tiers, the project layout and source-set hierarchy, the kotlin {} DSL and version catalogs, the
Android-KMP library plugin, expect/actual, the dependency ecosystem, coroutines and dispatchers, shared view
models, Ktor, SQLDelight, Room and DataStore, Koin, the iOS integration options, Objective-C and Swift interop and
SKIE, consuming suspend and Flow from Swift, Kotlin/Native memory and binary options, the Compose Multiplatform
entry points, resources, navigation, iOS interop and desktop packaging, Wasm and JS, testing, publishing, a CI
snippet and an adoption checklist — handy for quick memorization or as a printable desk reference.
For the full explanation, every option, and additional examples, see the dedicated pages:
Foundations — What Kotlin Multiplatform Is and When to Use It, How KMP Compiles: Kotlin/JVM, Kotlin/Native, Kotlin/JS and Kotlin/Wasm, Getting Started: IDEs, the KMP Plugin and Your First Project, Project Structure, Targets, Source Sets and the Hierarchy Template, Gradle Configuration, the Multiplatform DSL and Compatibility, The Android Target: the Android-KMP Library Plugin and AGP 9, expect/actual and Calling Platform APIs, and Dependencies, klibs.io, cinterop and SwiftPM Import.
Sharing business logic — Kotlin for Swift Developers, Coroutines, Flow and Concurrency in Shared Code, Architecture, Shared ViewModels and State, Networking with the Ktor Client, Local Storage: SQLDelight, Room, SQLite Drivers, DataStore and Settings, Dependency Injection in KMP: Koin, Metro and Manual DI, and Essential Multiplatform Libraries.
iOS integration and interop — Integrating Shared Code into iOS: Direct, SwiftPM and CocoaPods, Objective-C Interop, Swift Export and SKIE, Consuming Coroutines and Flow from Swift and SwiftUI, and Kotlin/Native Memory, Performance, Binary Size and Debugging.
Sharing UI with Compose Multiplatform — Compose Multiplatform Fundamentals, Resources and Localization in Compose Multiplatform, Lifecycle, ViewModel and Navigation in Compose Multiplatform, Layouts, Material 3, Adaptive UI, Popups and Accessibility, Compose Multiplatform on iOS: UIKit and SwiftUI Interop, Compose Multiplatform for Desktop, and Web Targets: Kotlin/Wasm, Kotlin/JS and Compose for Web.