Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Pragmatic Code Sharing with Kotlin Multiplatfor...
Search
Márton Braun
March 17, 2024
Programming
1
390
Pragmatic Code Sharing with Kotlin Multiplatform (Simonyi 2024)
Márton Braun
March 17, 2024
Tweet
Share
More Decks by Márton Braun
See All by Márton Braun
Blazing Fast UI Development with Compose Hot Reload (droidcon New York 2025)
zsmb
1
370
Building a macOS screen saver with Kotlin (KotlinConf 2025)
zsmb
1
99
Compose Hot Reload is here, stop re-launching your apps! (Android Makers 2025)
zsmb
1
720
Building a macOS screen saver with Kotlin (Android Makers 2025)
zsmb
1
280
What’s New in Compose Multiplatform - A Live Tour (droidcon London 2024)
zsmb
1
760
Kotlin Multiplatform at Stable and Beyond (Kotlin Vienna, October 2024)
zsmb
2
750
Composing an API the *right* way (Droidcon New York 2024)
zsmb
2
970
Composing an API the *right* way (Droidcon Berlin 2024)
zsmb
2
1.5k
What’s New in Compose Multiplatform - A Live Tour (droidcon Berlin 2024)
zsmb
2
790
Other Decks in Programming
See All in Programming
SOCI Index Manifest v2が出たので調べてみた / Introduction to SOCI Index Manifest v2
tkikuc
1
110
技術的負債で信頼性が限界だったWordPress運用をShifterで完全復活させた話
rvirus0817
1
2.1k
AIレビュアーをスケールさせるには / Scaling AI Reviewers
technuma
2
230
Flutterと Vibe Coding で個人開発!
hyshu
1
260
大規模FlutterプロジェクトのCI実行時間を約8割削減した話
teamlab
PRO
0
490
オホーツクでコミュニティを立ち上げた理由―地方出身プログラマの挑戦 / TechRAMEN 2025 Conference
lemonade_37
2
490
TROCCO×dbtで実現する人にもAIにもやさしいデータ基盤
nealle
0
330
UbieのAIパートナーを支えるコンテキストエンジニアリング実践
syucream
2
700
ゲームの物理
fadis
5
1.5k
マイコンでもRustのtestがしたい その2/KernelVM Tokyo 18
tnishinaga
2
2.3k
State of CSS 2025
benjaminkott
1
120
Portapad紹介プレゼンテーション
gotoumakakeru
1
130
Featured
See All Featured
Thoughts on Productivity
jonyablonski
69
4.8k
Building Adaptive Systems
keathley
43
2.7k
Statistics for Hackers
jakevdp
799
220k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
44
2.4k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
30
9.6k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
7
820
Embracing the Ebb and Flow
colly
87
4.8k
Documentation Writing (for coders)
carmenintech
73
5k
Optimizing for Happiness
mojombo
379
70k
Speed Design
sergeychernyshev
32
1.1k
Practical Orchestrator
shlominoach
190
11k
Transcript
Kotlin Multiplatform Kódmegosztás pragmatikusan Braun Márton Developer Advocate JetBrains
iOS Android Desktop Web Server
iOS Android Desktop Web Server
kotl.in/kmp-case-studies
None
None
Projekt kezdete
Projekt kezdete Kotlin/JVM .kt .class Java .java .class
Nyilvános bejelentés Projekt kezdete Open source Kotlin/JVM .kt .class Java
.java .class
Nyilvános bejelentés Projekt kezdete Open source Kotlin/JVM .kt .class Kotlin
1.0
Kotlin 1.0 Nyilvános bejelentés Projekt kezdete Open source JavaScript Kotlin/JVM
.kt .class Kotlin/JS .kt .js
Kotlin 1.0 Nyilvános bejelentés Projekt kezdete Open source Native JavaScript
Kotlin/JVM .kt .class Kotlin/Native .kt .klib|.kexe Kotlin/JS .kt .js
Kotlin 1.0 Nyilvános bejelentés Projekt kezdete Open source Native JavaScript
KMP stable
Kotlin 1.0 Nyilvános bejelentés Projekt kezdete Open source Native JavaScript
KMP stable Wasm Kotlin/JVM .kt .class Kotlin/Native .kt .klib|.kexe Kotlin/JS .kt .js Kotlin/Wasm .kt .wasm
Jetpack KMP Kotlin first Java + Kotlin Kotlin 1.0 Nyilvános
bejelentés Projekt kezdete Open source Native JavaScript KMP stable Wasm
iOS Android Desktop +
Desktop + Android iOS .kt .kt .class .framework
iOS .class .framework Desktop + Android .kt .kt
Common .kt .kt
.kt .kt .kt .kt Android Desktop iOS Common
.kt .kt .kt .kt Android Desktop iOS Common
.kt .kt .kt .kt Android Desktop iOS Common
.kt .kt .kt Android Desktop iOS Common .kt
.kt .kt .kt .kt Android Desktop iOS Common
.kt .kt .kt Android Desktop iOS Common class Person(val name:
String, var age: Int) fun greet(person: Person) { println("Hello, ${person.name}") }
.kt .kt .kt Android Desktop iOS Common fun List<Person>.duplicates(): Map<String,
Int> { return map { it.name.substringBefore(" ") } .groupingBy { it } .eachCount() .filter { (name, count) -> count > 1 } }
Android Desktop iOS actual Common expect actual actual
Android Desktop iOS Common expect actual actual actual
Android Desktop iOS Common fun getPlatform(): String expect actual actual
actual
Android Desktop iOS Common fun getPlatform(): String fun getPlatform(): String
= "Java ${System.getProperty("java.version")}" expect actual actual actual
Android Desktop iOS Common fun getPlatform(): String fun getPlatform(): String
= "Java ${System.getProperty("java.version")}" fun getPlatform(): String = "Android ${Build.VERSION.SDK_INT}" expect actual actual actual
Android Desktop iOS Common fun getPlatform(): String fun getPlatform(): String
= "Java ${System.getProperty("java.version")}" fun getPlatform(): String = "iOS ${UIDevice.currentDevice.systemVersion}" fun getPlatform(): String = "Android ${Build.VERSION.SDK_INT}" expect actual actual actual
Multiplatform libraries
github.com/terrakok/kmp-awesome
.kt .kt .kt Android Desktop iOS Common import io.ktor.client.* suspend
fun loadHtml(): String { val client = HttpClient() val response = client.get("https://kotlinlang.org") return response.body<String>() }
Shared logic
Shared logic Swing Desktop logic Android Views Android logic SwiftUI
iOS logic
Shared logic Swing Desktop logic Android Views Android logic SwiftUI
iOS logic
Shared logic Swing Desktop logic Android Views Android logic SwiftUI
iOS logic
Compose Multiplatform jb.gg/compose
Compose Multiplatform jb.gg/compose
Swing Desktop logic Android Views Android logic SwiftUI iOS logic
Shared logic
Desktop logic Android logic iOS logic Shared logic Shared UI
Compose Multiplatform
Desktop logic Android logic iOS logic Shared logic Shared UI
Compose Multiplatform Swing Android Views SwiftUI
Preview
None
None
None
None
None
None
None
Kotlin alapú szoftverfejlesztés VIAUAV41 Free Educational Licenses jb.gg/edulicense Kotlin Multiplatform
jb.gg/kmp Compose Multiplatform jb.gg/compose Fleet jb.gg/fleet Kotlin Multiplatform Kódmegosztás pragmatikusan zsmb.co/talks Braun Márton
[email protected]