And that, folks, is how we shared code between Android, iOS and the Backend
summary
Builds a small Kotlin Multiplatform library of DTOs then publishes it to a local Maven repo and uses it from a Ktor backend, an Android app and an iOS app. Faces iOS distribution pain, solves it with a fat framework + CocoaPods wrapper, hits Swift deserialization issues and Kotlin/Native concurrency errors that require changes to classes and to freeze mutable classes before crossing threads. Recommends starting very small, validates in production despite alpha status, then expand.
AI-written summary · about
chapters (31)
- 0:00Introduction and speaker intro
- 1:39Story of Alice and Bob's bug
- 3:08Story of Charlie's feature duplication
- 4:38Cross-platform challenges with React Native
- 6:25Why Kotlin Multiplatform fits
- 7:06Approaching KMP in existing projects
- 8:53Starting with boring or central code
- 10:38Example starting points like DTOs
- 11:21Building the shared foundation library
- 12:25Creating the KMP project
- 13:07Adding JVM target and publishing
- 13:50Writing the shared DTO data class
- 14:10Publishing and integrating the library
- 14:40Using the library in Android client
- 15:01Integrating with backend Ktor
- 15:45iOS integration challenges
- 16:33Distributing Kotlin frameworks to iOS
- 18:46Creating fat frameworks for iOS
- 19:27Configuring Gradle tasks for fat frameworks
- 20:49Linking library in Xcode project
- 21:56Publishing and versioning frameworks
- 23:56iOS serialization issues with DTOs
- 25:56Making DTOs compatible with Codable
- 27:14Adjusting Kotlin DTOs for iOS
- 28:16Threading and freezing DTOs
- 30:59Creating base class for frozen DTOs
- 31:48Summary of challenges faced
- 33:50Lessons learned and project validation
- 36:23Expanding KMP adoption at Unwire
- 37:12References and resources
- 37:35Q&A session
related talks
39mAnd That, Folks, is How We Shared Code Between Android, iOS and the Backend
17mKotlin Multiplatform – Sharing is caring!
27mKotlin: Multi-Platform
36mGoing Multiplatform with Kotlin
52mKotlin Multiplatform, a language to rule them all
57mKotlin for Writing Common Code for Android and iOS
52mIntroducing Kotlin Multiplatform in an existing project
27mAn Android Dev start to Kotlin Multiplatform
