Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Understanding Kotlin Multiplatform

Understanding Kotlin Multiplatform

Google I/O Extended Incheon 2025에서 진행한 Understanding Kotlin Multiplatform의 Speaker Deck입니다.

Avatar for HyunWoo Lee

HyunWoo Lee

July 26, 2025
Tweet

More Decks by HyunWoo Lee

Other Decks in Programming

Transcript

  1. Understanding Kotlin Multiplatform HyunWoo Lee Android/React Native Engineer, Viva Republica(Toss)

    Organizer, GDG Korea Android/Kotlin User Groups Seoul Kotlin Multiplatform: Theory and Practice
  2. Google I/O Extended 25 Google Docs Google Docsח iOS ജ҃ীࢲ

    KMPܳ ഝਊೞҊ ੓णפ׮. ӝઓ ௏٘৬ ࠺Ү೮ਸ ٸ ࢿמ ର੉о ௼ѱ ա૑ ঋҊ য়൤۰ ੉੹ࠁ׮ ؊ જ਷ ҃਋ب ੓णפ׮.
  3. Google I/O Extended 25 Juliana Chahoud ੷൞ח 55% о۝੄ ௏٘ܳ

    KMPܳ ഝਊೞৈ ҕਬೞҊ ੓णפ׮. ؋࠙ী ӝמ ѐߊਸ ೡ ٸ ড 40% ੿ب ࡈۄ૓ Ѫ эणפ׮. Sr Director of Engineering, StoneCo
  4. Google I/O Extended 25 উ٘۽੉٘ ௏٘о ੘ࢿػ ࢚ടীࢲ ࡅܰѱ iOSীب

    ੸ਊೞӝ ਤ೧ ࠺ૉפझ ۽૒ਸ ҕਬೡ ࣻ ੓ח KMPܳ ଻ఖ೮णפ׮. Duolingo
  5. Google I/O Extended 25 Advantage of KMP ֎੉౭࠳ ӝמਸ ࢿמ

    ੷ೞ হ੉ Ӓ؀۽ Virtual Machine ҅க੉ হয ੘ࢿػ ௏٘о ೒ۖಬ੄ ֎੉౭࠳ ௏٘۽ ஹ౵ੌؾפ׮. ੼૓੸ੋ ௏٘ ݃੉Ӓۨ੉࣌੉ оמ ֎੉౭࠳ ௏٘۽ ஹ౵ੌ غӝী ӝઓ ௏٘ب ഝਊೡ ࣻ ੓Ҋ ੉ܳ ഝਊ೧ࢲ ࠗ࠙ ੸ਊ, ੼૓੸ ੸ਊ੉ оמ೤פ׮. ௏٘ ੤ࢎਊࢿҗ ࢎਊ੗ ҃೷੄ ੌҙࢿ زੌೠ ௏٘߬੉झܳ ৈ۞ ೒ۖಬী ҕਬо оמೞৈ ௏٘ ੤ࢎਊࢿਸ ֫ੌ ࣻ ੓Ҋ ੉ী ٮۄ ೒ۖಬী ޖҙೞѱ زੌೠ ҃೷ਸ ઁҕೡ ࣻ ੓णפ׮.
  6. Google I/O Extended 25 01 ࢎਊ੗ীѱ “જ਷” ҃೷ਸ ઁҕ೧઴ ࣻ

    ੓যঠೠ׮. 02 ೐ۨ੐ਕ௼ܳ ഝਊೠ জٜ੉ द੢ীࢲ જ਷ Ѿҗܳ ࠁৈ઻ঠ ೠ׮ 03 ೧׼ ӝࣿਸ ӝ߈ਵ۽ ࢿҕ੸ੋ ழܻযܳ ऺ਷ ੹ޙоٜ੉ ੓যঠೠ׮. Good Framework? KMPח ֎੉౭࠳ জٜҗ زੌೠ ࢿמਵ۽ ӝמਸ ҳഅೡ ࣻ ੓਺ ௏٘߬੉झܳ ҕਬೞҊ ѐߊ दрਸ ױ୷ೞৈ द੢ী ࡅܰҊ উ੿੸ਵ۽ ઁಿਸ ࢶࠁੌ ࣻ ੓਺ ӝઓ Kotlin, Android ੹ޙоٜਸ ഝਊೡ ࣻ ੓਺
  7. Google I/O Extended 25 Jetpack੄ KMPച? 800+ Jetpack ݽٕ іࣻ

    • ݽٚ Jetpack ۄ੉࠳۞ܻܳ KMP ੹ജदఃח Ѫ ਷ ࠺ബਯ੸੉׮. (Android ౠച ۄ੉࠳۞ܻب ઓ ੤ೣ) • ݽٚ KMP ۄ੉࠳۞ܻٜਸ ݽٚ ೒ۖಬী ૑ਗೡ ࣻ ੓ѱ ੘সೞח Ѫب दрബਯ੸੉૑ ঋ׮.
  8. Google I/O Extended 25 Tier 1 Tier 2 Tier 3

    • Android • JVM • iOS • macOS • Linux • watchOS • tvOS • Windows • WASM(Web)
  9. Google I/O Extended 25 Tier 1 Tier 2 Tier 3

    • CIীࢲ Unit Test, Device Test ࣻ೯ • ߡ੹ ੿଼ী ٮۄࢲ Binary compatibility ౟ېఊ • CIীࢲ Unit Test݅ ࣻ೯ • Binary Compatibility ࣻ೯ X • CI పझ౟ ࣻ೯ X • Binary Compatibility ࣻ೯ X
  10. Google I/O Extended 25 Stable Commonized Alpha • Binary Compatibility

    ࠁ੢ • 1 tier ೒ۖಬীࢶ औѱ ా೤द ఆ ࣻ ੓਺ • Binary Compatibility ࠁ੢ • ࣻز Integration • ৈ੹൤ ѐߊ઺ • APIٜ੉ ߸҃ؼ ࣻ ੓਺
  11. Google I/O Extended 25 System Lint Productivity • Kotlin/Native ஹ౵ੌ۞

    ੋ LLVM 16ਵ۽ ೱ࢚ • ࢜۽਍ ޙ੗ৌ ಴അ ҳഅ ߂ GC ࢿמ ೱ࢚ਵ۽ ۠ఋ੐ ࢿמ ߂ ݫݽܻ ࢎਊ۝ ѐࢶ • KMP ௏٘੄ ੿੸࠙ࢳਸ ਤ೧ Kotlin ఋѶ ؀࢚ਵ۽ Android Lint ૑ਗ • Binary compatibility tracking • AGP(Android Gradle Plugin) & KGP(Kotlin Gradle Plugin) API ా೤
  12. ӒܻҊ Gradle ௏٘ܳ झਸ਼ ࠁݶ Target? sourceSet? binaries? framework? kotlin

    { targets .filterIsInstance<KotlinNativeTarget>() .forEach { target -> target.binaries { framework { baseName = "Snup" isStatic = true } } } sourceSets { androidMain.dependencies { implementation(compose.preview) implementation(libs.androidx.activity.compose) } commonMain.dependencies { implementation(projects.feature.preview) implementation(libs.androidx.lifecycle.viewmodel) implementation(libs.androidx.lifecycle.runtimeCompose) implementation(libs.androidx.navigation.compose) implementation(libs.kotlinx.serialization.json) } commonTest.dependencies { implementation(libs.kotlin.test) } } }
  13. ೐۽ં౟ ௏٘ܳ ஹ౵ੌೡ ؀࢚ ఋѶਸ ࢶ঱ ࣗझ ௏٘ܳ ೒ۖಬ р

    ҕਬೡ ࣻ ੓ب۾ ҳࢿ Kotlin Multiplatform ೐۽ં౟ ҳࢿ
  14. • যڃ ೒ۖಬ੄ ই౭ಂ౟ܳ ࢤࢿೡ Ѫੋ૑ ੿ ੄ೞח Ѫ •

    ੐੄۽ ੉ܴਸ ࠢੌ ࣻب ੓Ҋ ೒ۖಬ ߹۽ ৈ ۞ѐ੄ ఋӥਸ ૑੿ೡ ࣻ ੓਺ Targets
  15. plugins { … } kotlin { androidLibrary { namespace =

    “io.google.extended.incheon” compileSdk = 35 } iosX64 { … } }
  16. • ஹ౵ੌ җ੿ীࢲ ୊ܻغח Kotlin ࣗझ ౵ੌ, ੄ઓࢿ, ܻࣗझ ҙ۲

    ੿ࠁٜਸ ੿੄ೞח ҕр • ׮ܲ Source Setী ੄ઓ ҙ҅ܳ ࢸ੿೧ ௏٘ ܳ ҕਬೡ ࣻ ੓Ҋ ೙ਃೠ ҃਋ ੐੄੄ ழझథ ࣗझࣇਸ ੿੄ೡ ࣻ ੓਺ Source Sets
  17. kotlin { sourceSets { commonMain.dependencies { … } wasmJsMain {

    dependencies { implementation(libs.kotlinx.immutable) } } val nonWasmJsMain by creating { dependsOn(commonMain.get()) } appleMain { dependsOn(nonWasmJsMain) } desktopMain { dependsOn(nonWasmJsMain) } androidMain { dependsOn(nonWasmJsMain) } } }
  18. kotlin { sourceSets { commonMain.dependencies { … } wasmJsMain {

    dependencies { implementation(libs.kotlinx.immutable) } } val nonWasmJsMain by creating { dependsOn(commonMain.get()) } appleMain { dependsOn(nonWasmJsMain) } desktopMain { dependsOn(nonWasmJsMain) }
  19. } val nonWasmJsMain by creating { dependsOn(commonMain.get()) } appleMain {

    dependsOn(nonWasmJsMain) } desktopMain { dependsOn(nonWasmJsMain) } androidMain { dependsOn(nonWasmJsMain) } } }
  20. val nonWasmJsMain by creating { dependsOn(commonMain.get()) } appleMain { dependsOn(nonWasmJsMain)

    } desktopMain { dependsOn(nonWasmJsMain) } androidMain { dependsOn(nonWasmJsMain) }
  21. Google I/O Extended 25 • ݽٕ ղীࢲ ࢶ঱ػ ݽٚ ݽٕীࢲ

    ࢎਊغח ҕా ௏٘ܳ ੘ࢿೞח ࣗझࣇੑפ׮. • ࢶ঱ػ ೒ۖಬী ஹ౵ੌ ؼ ࣻ ੓ח ௏٘ܳ ੘ࢿೡ ࣻ݅ ੓ਵݶ commonMainীࢲ ੘ࢿೡ ࣻ ੓णפ׮. • ݽٕী androidTarget, jvm݅ ࢸ੿೮׮ݶ, commonMainীࢲب jvm ఋѶ ௏٘ܳ ੘ࢿೡ ࣻ ੓णפ׮. What is “common”? Common਷ ఋѶب, ೒ۖಬب ইתפ׮.
  22. Google I/O Extended 25 JAR/AAR • JVM & Android ؀࢚

    • ӝઓҗ زੌೠ ߑध • Gradleীࢲ ࢎਊೣ Klib • JVM & Android ઁ৻ ఋѶ • Gradleীࢲ ࢎਊೣ XCFramework • iOS ੹ਊ Binary format • Cocoapods/SPM(Swift Package Manager) ഝਊ ೞৈ ࢎਊೡ ࣻ ੓਺ Binary formats
  23. plugins { … } kotlin { // androidLibrary { …

    } iosX64 { binaries { framework { baseName = “NunuFramework” } } } build.gradle
  24. Google I/O Extended 25 • ѐߊ઺ੌ ٸח ࠽٘ दী ѐߊ઺ੋ

    Shared Module(KMP Module)੄ ࠽٘ Ѿҗޛਸ জী ನೣೠ׮ • ߓನܳ ೡ ٸীח Gradleীࢲ ۄ੉࠳۞ܻܳ ࢎਊೞח Ѫ୊ۢ Cocoapods, Swift Package Managerীࢲ ׮਍߉ਸ ࣻ ੓ب۾ ৻ࠗ ࢲߡী ೐ۨ੐ਕ௼ܳ ߓನ/ࢸ੿ೠ׮. ৈӝࢲ ՘ੌө? ઁ੘݅ ೧֬ও૑ iOS জী ֍૑ ঋও׮.
  25. Google I/O Extended 25 Swift Package Manager • Appleীࢲ ӂ੢ೞח

    Binary package ߓನ ҙܻ ߑध • അ੤ iOS ࢤక҅੄ Best Practice Apple੄ ҕध੸ੋ Package Manager
  26. Google I/O Extended 25 Swift Package Manager • ./gradlew <your_shared>:assembleXCFramework

    • XCFrameworkܳ .zipਵ۽ ݅׮ • Github Release৬ э਷ ܻݽ౟ ജ҃ী ৢ۰֬ח׮ • Package.swift ౵ੌਸ ੘ࢿೠ׮ • ৻ࠗ ۨನ૑ఠܻী Package.swift ౵ੌਸ ޻য֍ח׮ How to deploy “framework”?
  27. import PackageDescription let package = Package( name: “Nunu”, platforms: [

    .iOS(.v14), ], products: [ … ], targets: [ .binaryTarget(name: “Nunu”, url: “<XCFramework ZIP ౵ੌ স۽٘ೠ ઱ࣗ>”, // swift package compute-checksum NunuExmaple ݺ۸য प೯ checksum: “<प೯ػ Ѿҗޛਸ ৈӝী ੑ۱>” ] ) Package.swift
  28. Google I/O Extended 25 CocoaPods • ੉޷ iOS ѐߊ੗ٜ੉ SPM੉

    ইצ CocoaPodsਸ ࢎਊೞҊ ੓׮ݶ ଻ఖ оמ • Gradle DSL۽ب ۄ੉࠳۞ܻ ߓನо оמೣ ੉ઁח ҳध੉ ػ ࢲ٘౵౭ ಁః૑ ݒפ੷
  29. Google I/O Extended 25 CocoaPods • CocoaPodsܳ ࢸ஖೤פ׮. • rvm

    install ruby x.y.z sudo gem install -n /usr/local/bin cocoapods • Gradleী CocoaPods ߓನ ҙ۲ ࢸ੿ਸ ੘ࢿ೤פ׮. • ./gradlew :{shared_module}:podPublishXCFramework How to deploy “framework”?
  30. Google I/O Extended 25 CodeLab - Get Started with Kotlin

    Multiplatform CodeLab - Migrate existing apps to Room KMP
  31. Thank You HyunWoo Lee Android/React Native Engineer, Viva Republica(Toss) Organizer,

    GDG Korea Android/Kotlin User Groups Seoul Kotlin Multiplatform: Theory and Practice