Effective Kotlin-Swift Interoperability
summary
Kotlin/Native produces a Kotlin/Native framework consumed by Xcode via an exported Objective‑C API and a Gradle task that copies artifacts into the Xcode build; linking dominates local builds (profiling shows ~60% of time, tens to hundreds of seconds). Language compromises surface: enums lose exhaustiveness unless a Swift bridge (RawRepresentable + unknown case) is written, generics require an upper‑bound (Any) to avoid nullable signatures, and Kotlin native runs CPU‑heavy code ~2x slower than native Swift. Also note a build cache bug caused by absolute paths in the Kotlin Gradle task.
AI-written summary · about
chapters (14)
- 0:00Introduction
- 1:15TLDR
- 2:48Setup
- 3:15Android Studio
- 3:56Source Sets
- 5:20Xcode
- 8:57ObjectiveC
- 16:37Common Library Support
- 27:54Generics
- 30:43Value Types
- 36:40Build Performance
- 39:44Runtime Performance
- 43:07Sequel Delight
- 44:48Protobufs
related talks
41mThe Kotlin Swift boundary
39mDependencies and Kotlin/Native
52mKEYNOTE: Kotlin/Native – Embracing existing ecosystems
18mKotlin native
33mAdvanced Kotlin Native Integration
43mThe Triumphs and Tribulations of Kotlin-Native in Practice
33mKotlin Multiplatform Alchemy: Making Gold out of Your Swift Interop
30mReusable Cross-Platform Frameworks with Kotlin/Native
