When would you use Kotlin Multiplatform, and what makes it work well for the iOS team?
AndroidSenior
In shortShare logic that must be identical on both platforms (rules, networking, storage, sync) and keep UI and platform integrations native. Make the exported API Swift-friendly: declared exceptions, adapters for Flows and sealed classes (SKIE), small facades, and a build integration iOS developers can live with.
Model answer
What to share: code that must behave identically: domain models and rules, repositories, networking with Ktor, storage with SQLDelight or Room KMP, sync and caching, sometimes presentation state. Keep UI native (or adopt Compose Multiplatform deliberately), and keep integrations like health data, payments and push native.
How: commonMain with multiplatform libraries (coroutines, serialization, datetime); expect/actual for small primitives; interfaces implemented by each app for bigger capabilities, which keeps common code testable; tests in commonTest run on every target.
Swift interop: Swift sees Kotlin through Objective-C. Suspend functions become async, but only exceptions declared with @Throws become Swift errors; undeclared ones crash the app. Flows need adapters (SKIE, KMP-NativeCoroutines or callback wrappers); sealed classes aren’t exhaustive in Swift without SKIE. Export small facades with clear names.
Adoption: start with one valuable module (a rules engine, sync), with owners from both platforms; integrate through the Gradle build phase in a monorepo or an XCFramework via SPM; budget for Kotlin/Native build time and a few MB of binary size; measure cross-platform bug counts and time to ship rules on both platforms.
What they're looking for
Judgment about what to share, expect/actual vs interfaces, multiplatform libraries, Swift interop pitfalls (exceptions, Flows, sealed classes), and adoption concerns (ownership, build time, binary size, distribution).
Common mistakes
- Sharing UI and platform integrations first.
- Exporting suspend functions without @Throws.
- Treating it as an Android-team-only project.
More android questions
- How do you make sure background work in a mobile app stops when the user leaves the screen?Mid-level
- What's the difference between a configuration change and process death on Android, and what survives each?Mid-level
- How would you modularize a large Android app, and how do you keep builds fast?Senior
- How do you store an auth token securely on Android?Mid-level