# Kotlin Multiplatform taste of a mobile developer who wants one codebase without fighting either platform
- Share business logic, networking, persistence and validation first; keep native UI per platform unless the team explicitly chooses Compose Multiplatform. Confidence: 0.80
- Start from the official KMP wizard template and keep the module layout boring: shared, androidApp, iosApp. Confidence: 0.75
- Split a growing shared module into feature modules early instead of one giant shared module. Confidence: 0.70
- Keep expecthttps://www.aitopic.com/actual declarations tiny and few; prefer interfaces in common code with platform implementations injected at startup. Confidence: 0.85
- Use Ktor client in commonMain with the platform engines (OkHttp on Android, Darwin on iOS) and kotlinx.serialization for JSON. Confidence: 0.90
- Use SQLDelight or Room for KMP for local storage so schemas and queries live in shared code. Confidence: 0.80
- Use kotlinx-datetime instead of platform date APIs in shared code. Confidence: 0.85
- Expose suspend functions and Flow from shared code and use SKIE or KMP-NativeCoroutines so Swift gets asynchttps://www.aitopic.com/await and AsyncSequence. Confidence: 0.80
- Never block the main thread in shared code; inject dispatchers so tests can swap them. Confidence: 0.85
- Keep shared ViewModels or presenters platform-neutral and expose immutable UI state as StateFlow. Confidence: 0.75
- Use Koin or manual constructor injection in common code; avoid DI frameworks that only work on Android. Confidence: 0.70
- Design the Swift-facing API on purpose: avoid generics-heavy, sealed-class-heavy or default-argument APIs that translate badly to Objective-C headers. Confidence: 0.80
- Ship the iOS framework through Swift Package Manager (XCFramework) or direct integration rather than CocoaPods for new projects. Confidence: 0.70
- Manage versions with a Gradle version catalog and keep Kotlin, Compose and AGP versions upgraded together. Confidence: 0.85
- Put build logic in convention plugins instead of copy-pasting Gradle blocks across modules. Confidence: 0.75
- Write most tests in commonTest with kotlin.test and run them on both JVM and iOS simulator targets. Confidence: 0.85
- Use Turbine for testing Flows and fakes over mocking libraries that do not support Kotlinhttps://www.aitopic.com/Native. Confidence: 0.75
- Handle errors with sealed result types at the shared boundary instead of letting Kotlin exceptions crash Swift callers. Confidence: 0.80
- Mark functions that can throw to Swift with @Throws so iOS sees real errors. Confidence: 0.85
- Keep secrets and API keys out of shared code; load them per platform from the build config or a backend. Confidence: 0.85
- Cache Gradle and Kotlinhttps://www.aitopic.com/Native artifacts in CI and run iOS builds only on macOS runners when shared or iOS code changes. Confidence: 0.75
- Let iOS developers review shared module API changes so Kotlin-first decisions do not surprise the Swift side. Confidence: 0.70
Comments & Questions (0)
No comments yet
Be the first to comment!