And that, folks, is how we shared code between Android, iOS and the Backend
summary
Shows a real migration: a shared KMP library (HN foundation) with DTOs published to a local Maven, consumed by an Android app, a Ktor backend endpoint, and an iOS app via a fat framework packaged to CocoaPods. Describes concrete fixes: convert data class to open class with var and empty ctor for Swift Decodable, add Stately freeze to avoid Kotlin/Native threading exceptions, automate Gradle tasks and pod publishing with scripts, later share the data layer with SQLDelight. Works in production at a startup but KMP is still alpha.
AI-written summary · about
chapters (37)
- 0:00Introduction and speaker intro
- 1:13Common pitfalls in cross-platform development
- 3:01Execution speed challenges in teams
- 5:31Why Kotlin Multiplatform fits
- 7:17Starting with Kotlin Multiplatform libraries
- 9:49Choosing the right code to share
- 10:12Building the shared library project
- 12:24Publishing and integrating the library
- 13:11Android integration demo
- 13:34Backend integration demo
- 13:55iOS integration challenges
- 16:27CocoaPods plugin limitations
- 17:10Creating FAT frameworks for iOS
- 18:36CocoaPods repository setup
- 19:37iOS dependency integration
- 20:41Automating the build and publish process
- 22:29iOS serialization issues
- 24:35Implementing Decodable in Swift
- 26:03Adjusting Kotlin models for Swift
- 27:09Threading and immutability in Kotlin
- 28:54Using Stately for freezing objects
- 29:39Finalizing iOS integration
- 30:01Summary of challenges faced
- 31:05Gradle and project organization difficulties
- 32:13Distributing iOS frameworks effectively
- 32:55Handling serialization on iOS
- 33:37Start small, validate, then expand
- 34:47Expanding to full data layer sharing
- 35:11References and resources
- 35:33Q&A session begins
- 37:44Future of Kotlin Multiplatform UI
- 38:45Flutter vs Kotlin Multiplatform for UI
- 39:49Dependency injection in Kotlin Multiplatform
- 41:37Nullability agreements between backend and frontend
- 43:06Android Studio plugin for Kotlin Multiplatform
- 44:09Shared databases and networking support
- 44:50Kotlin Multiplatform library list suggestion
related talks
39mAnd That, Folks, is How We Shared Code Between Android, iOS and the Backend
36mGoing Multiplatform with Kotlin
27mKotlin: Multi-Platform
17mKotlin Multiplatform – Sharing is caring!
52mIntroducing Kotlin Multiplatform in an existing project
52mKotlin Multiplatform, a language to rule them all
57mKotlin for Writing Common Code for Android and iOS
27mAn Android Dev start to Kotlin Multiplatform
