Mobile Framework Deep Dive

Kotlin Multiplatform

Share business logic — networking, persistence, validation — across Android, iOS, web, and desktop. Keep the UI native (SwiftUI on iOS, Compose on Android) where it matters most.

KotlinNative & JVM & JS & WasmLogic SharingJetBrainsPragmatic
← Back to Client Side
Quick Facts

At a Glance

Language
Stable
2023 · JetBrains
Targets
JVM, Android, iOS, macOS, Windows, Linux, JS, Wasm
UI options
Native per platform or Compose Multiplatform
Notable users
Netflix, McDonald's, Philips, Cash App, 9GAG

Basic Concepts

  • Logic over UI: KMP's "sweet spot" is sharing models, networking, business rules — not necessarily the UI.
  • commonMain source set holds shared Kotlin code; androidMain / iosMain hold platform specifics.
  • expect / actual declarations let shared code reference platform APIs that are implemented per target.
  • Kotlin/Native compiles to a static framework on iOS — Swift code calls it like any Cocoa library.
  • Compose Multiplatform (sister project) extends UI sharing to iOS, desktop, and web.
Syntax

Taste of KMP

// commonMain — shared business logic
class ProductRepository(private val client: HttpClient) {
    suspend fun fetchProducts(): List<Product> =
        client.get("https://api.example.com/products").body()
}

// commonMain — shared models
@Serializable
data class Product(val id: String, val name: String, val price: Double)

// expect / actual — platform-specific glue
expect class Logger() {
    fun log(message: String)
}

// androidMain
actual class Logger {
    actual fun log(message: String) = Log.d("App", message)
}

// iosMain
actual class Logger {
    actual fun log(message: String) = NSLog(message)
}
Mechanics

Key Features

Source Sets & Targets

A KMP module declares targets (androidTarget(), iosX64(), iosArm64(), jvm(), js()) and source sets (commonMain, androidMain, iosMain). Code is shared by default; platform-specific code lives in its own folder.

iOS Interop

Kotlin/Native compiles a shared.framework that Swift imports like any Apple framework. Suspend functions are exposed as completion-handler callbacks (or modern Swift async via SKIE / KMP-NativeCoroutines).

Compose Multiplatform

JetBrains' UI framework on top of KMP — share Compose UI between Android, iOS, desktop, and web (Wasm). The most ambitious cross-platform UI story in the JVM world.

Ecosystem
LibraryPurpose
Ktor ClientMultiplatform HTTP client.
SQLDelightType-safe SQL across platforms.
kotlinx.serializationJSON / ProtoBuf serialization.
kotlinx.coroutinesAsync & flows on every target.
KoinMultiplatform DI.
SKIEBetter Swift interop (async/await, sealed classes).
Trade-offs

Strengths & Weaknesses

Strengths
  • Pragmatic: share what makes sense, keep UI native.
  • iOS gets a real native framework — Swift devs barely notice.
  • Backed by JetBrains; first-class IntelliJ / Android Studio support.
  • Same Kotlin you already use for Android.
Weaknesses
  • Smaller community than Flutter / React Native.
  • Swift interop has rough edges (improving with SKIE).
  • Build tooling (Gradle) intimidates iOS devs.
  • Compose Multiplatform iOS support is still maturing.
Where It Shines

Sweet Spots

Apps with Heavy Business Logic

Banking, fitness, e-commerce — share rules & networking; keep UI native.

Android-First Teams

Kotlin shop adding iOS without learning React Native or Flutter.

SDK Authors

Ship one Kotlin codebase; consumers get a native SDK on each platform.

Compose Everywhere

Share UI across Android + iOS + desktop with Compose Multiplatform.

Continue

Other Mobile Frameworks