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 Multiplatform (Simonyi 2024)
Search
Márton Braun
March 17, 2024
Programming
0
150
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
Kotlin Multiplatform at Stable and Beyond (Android Makers 2024)
zsmb
0
520
Build Apps for iOS, Android & Desktop in 100% Kotlin With Compose Multiplatform (mDevCamp 2024)
zsmb
0
470
Composing an API the *right* way (Droidcon London 2023)
zsmb
0
530
Composing an API the *right* way (Droidcon Italy 2023)
zsmb
0
790
Avoiding common coroutine mistakes in Compose (KotlinConf '23)
zsmb
2
1k
Untangling Coroutine Testing (KotlinConf '23)
zsmb
1
860
Composing an API with Kotlin vol 2 (Advanced Kotlin Dev Day 2022)
zsmb
1
760
Composing an API with Kotlin (Kotlin Budapest Meetup 2022 October)
zsmb
0
440
Untangling Coroutine Testing (Droidcon Berlin 2022)
zsmb
2
1.3k
Other Decks in Programming
See All in Programming
Native Federation: The Future of Micro Frontends in Angular
manfredsteyer
PRO
0
110
MetricKitで予期せぬ終了を検知する話 / Detect unexpected termination with MetricKit
nekowen
1
200
Micro Frontends for Java Microservices - Utah JUG 2024
mraible
PRO
1
110
Implementing Design Systems in Swift
seyfoyun
2
480
PHPはいつから死んでいるかの調査
chiroruxx
2
420
Ruby Function Composition
bkuhlmann
1
340
if constexpr文はテンプレート世界のラムダ式である
faithandbrave
3
690
Scalable Customer Journey Orchestration (CJO)
lewuathe
0
430
CDKコントリビュートの最初の壁を越えよう! -簡単issueの見つけ方-
badmintoncryer
3
230
Code Reviews
bkuhlmann
4
900
Ruby GitHub Packages
bkuhlmann
0
650
Milestoner
bkuhlmann
1
420
Featured
See All Featured
Facilitating Awesome Meetings
lara
43
5.6k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
155
14k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
21
1.6k
How to Ace a Technical Interview
jacobian
273
22k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
117
18k
A Philosophy of Restraint
colly
197
16k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
22
1.4k
Fireside Chat
paigeccino
22
2.6k
Teambox: Starting and Learning
jrom
128
8.4k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
501
140k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
9
1.3k
Principles of Awesome APIs and How to Build Them.
keavy
121
16k
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]