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
KMP の Swift export
Search
Koki Hirokawa
October 02, 2025
Technology
0
490
KMP の Swift export
extension DC 2025 Day2 @Sansan
※ 2025/10/2 現在、Swift export のステータスは experimental です
Koki Hirokawa
October 02, 2025
Tweet
Share
More Decks by Koki Hirokawa
See All by Koki Hirokawa
SwiftUI移行のためのインプレッショントラッキング基盤の構築
kokihirokawa
0
350
App内課金におけるトラブルを劇的に減らすための取り組み
kokihirokawa
2
1.2k
ABEMAのリアーキテクチャ
kokihirokawa
5
5.2k
Detect Body and Hand Pose with Vision
kokihirokawa
0
930
Other Decks in Technology
See All in Technology
AS59105におけるFreeBSD EtherIPの運用と課題
x86taka
0
280
『星の世界の地図の話: Google Sky MapをAI Agentでよみがえらせる』 - Google Developers DevFest Tokyo 2025
taniiicom
0
410
確実に伝えるHealth通知 〜半自動システムでほどよく漏れなく / JAWS-UG 神戸 #9 神戸へようこそ!LT会
genda
0
150
Introduction to Sansan, inc / Sansan Global Development Center, Inc.
sansan33
PRO
0
2.9k
Digitization部 紹介資料
sansan33
PRO
1
6k
.NET 10のASP. NET Core注目の新機能
tomokusaba
0
140
名刺メーカーDevグループ 紹介資料
sansan33
PRO
0
960
.NET 10のEntity Framework Coreの新機能
htkym
0
130
Introduction to Bill One Development Engineer
sansan33
PRO
0
320
Sansan Engineering Unit 紹介資料
sansan33
PRO
1
3.2k
メッセージ駆動が可能にする結合の最適化
j5ik2o
9
1.6k
Bedrock のコスト監視設計
fohte
2
230
Featured
See All Featured
Visualization
eitanlees
150
16k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.7k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1k
Testing 201, or: Great Expectations
jmmastey
46
7.8k
The Power of CSS Pseudo Elements
geoffreycrofte
80
6.1k
Code Review Best Practice
trishagee
72
19k
Become a Pro
speakerdeck
PRO
30
5.6k
Art, The Web, and Tiny UX
lynnandtonic
303
21k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
1
56
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.5k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.6k
Speed Design
sergeychernyshev
33
1.3k
Transcript
KMP ͷ Swift export 2025/10/2 extension DC 2025 Day2 @Sansan
Koki Hirokawa
@pihero13 KokiHirokawa Sony Honda Mobility Inc. 1
Swift export ͱ Experimental Objective-C Λհͣ͞ʹ Swift ͔Β Kotlin Ͱॻ͔ΕͨॲཧΛݺͼग़ͨ͢Ίͷٕज़
2
ΞδΣϯμ KMP ͱ Objective-C export ͱ Swift export ͱ Objective-C
export ͱ Swift export ͷҧ͍ ·ͱΊ 3
KMP ͱ
KMP - ֓ཁ Kotlin Multiplatform KMP Λ༻͢ΔͱҟͳΔϓϥοτϑΥʔϜؒͰ Kotlin ίʔυΛڞ༗Ͱ͖Δ 5
KMP - ରԠϓϥοτϑΥʔϜ Android JVM iOS macOS Linux ... 6
Objective-C export ͱ
KMP - Apple platform 8
KMP - Apple platform 9
KMP - Apple platform 10
KMP - Apple platform 11
Objective-C header 12
Objective-C header 13
Objective-C export 14
Objective-C export Objective-C ͷϔομʔΛಡΉඞཁ͕͋Δ ͯ͢ͷ I/F ͕1ͭͷϔομʔʹ·ͱ·Δ Swift Β͘͠ͳ͍ API
͕ఏڙ͞ΕΔ͜ͱ͕͋Δ γʔϜϨεʹ౷߹Ͱ͖ͳ͍ 15
Swift export ͱ
Swift export Experimental 17
Swift export Experimental Kotlin Multiplatform Development Roadmap for 2024 ϩʔυϚοϓʹొ
18
Swift export Experimental Kotlin Multiplatform Development Roadmap for 2024 ϩʔυϚοϓʹొ
Kotlin Multiplatform Development Roadmap for 2025 ٸϐονͰ։ൃத 2025ͷඪ࠷ॳͷެ։൛ϦϦʔε 19
Swift export Experimental Kotlin Multiplatform Development Roadmap for 2024 ϩʔυϚοϓʹొ
Kotlin Multiplatform Development Roadmap for 2025 ٸϐονͰ։ൃத 2025ͷඪ࠷ॳͷެ։൛ϦϦʔε Kotlin 2.1.0 ॳظஈ֊ͷެ։ 20
Swift export Experimental What’s Next for Kotlin Multiplatform and Compose
Multiplatform – August 2025 Update suspend function Flow ͱ͍ͬͨඇಉظॲཧͷαϙʔτ 2026ʹ҆ఆ൛ͷϦϦʔεΛࢦ͢ 21
Swift export Experimental What’s Next for Kotlin Multiplatform and Compose
Multiplatform – August 2025 Update suspend function Flow ͱ͍ͬͨඇಉظॲཧͷαϙʔτ 2026ʹ҆ఆ൛ͷϦϦʔεΛࢦ͢ Kotlin 2.2.20 Experimental support 22
Swift export ͷ։ൃঢ়گ Experimental https://docs.google.com/spreadsheets/d/ 157wQt05ZyaJAP_P1wigXDs6nW9q7clqbpIDAfMrFhOg/ 23
Objective-C export ͱ Swift export ͷҧ͍
Top-level function Experimental Kotlin // Common.kt fun sharedFunction(): Int =
5 Objective-C export import Shared CommonKt.sharedFunction() Swift export import Shared sharedFunction() 25
Multi-module support Experimental Kotlin // Common.kt (Shared) fun sharedFunction(): Int
= 5 // Common.kt (module-a) fun sharedFunction(): Int = 10 Objective-C export import Shared CommonKt.sharedFunction() CommonKt_.sharedFunction() Swift export import Shared import ModuleA Shared.sharedFunction() ModuleA.sharedFunction() 26
Multi-module support Experimental Objective-C export // Shared.h __attribute__((objc_subclassing_restricted)) __attribute__((swift_name("CommonKt"))) @interface
SharedCommonKt : SharedBase + (int32_t)sharedFunction __attribute__((swift_name("sharedFunction()" ))); @end __attribute__((objc_subclassing_restricted)) __attribute__((swift_name("CommonKt_"))) @interface SharedCommonKt_ : SharedBase + (int32_t)sharedFunction __attribute__((swift_name("sharedFunction()" ))); @end Swift export // Shared.swift public func sharedFunction() -> Swift.Int32 { ExportedKotlinPackages.com.github.jetbrains. swiftexport.sharedFunction() } // ModuleA.swift public func sharedFunction() -> Swift.Int32 { ExportedKotlinPackages.com.github.jetbrains. modulea.sharedFunction() } 27
Package support Experimental Kotlin // MODULE: shared // FILE: Common.kt
package com.github.jetbrains.swiftexport fun sharedFunction(): Int = 5 // MODULE: shared // FILE: Common.kt package com.github.jetbrains.swiftexport.packagea fun sharedFunction(): Int = 10 28
Package support Experimental Objective-C export import Shared CommonKt.sharedFunction() CommonKt.sharedFunction_() Swift
export import Shared sharedFunction() packagea.sharedFunction() 29
Package support Experimental // ExportedKotlinPackages.swift public enum com { public
enum github { public enum jetbrains { public enum swiftexport { public enum packagea { } } } } } 30
Swift export ͷࢼ͠ํ Experimental // build.gradle.kts @OptIn(ExperimentalSwiftExportDsl::class) swiftExport { //
Root module name moduleName = "Shared" // Collapse rule flattenPackage = "com.github.jetbrains.swiftexport" } // Run Script Phase ./gradlew :shared:embedSwiftExportForXcode 31
Swift export ͷࢼ͠ํ Experimental https://github.com/Kotlin/swift-export-sample kotlin version Λ 2.2.20 ʹมߋ
32
·ͱΊ
·ͱΊ Swift ͔Β Kotlin Ͱॻ͔ΕͨॲཧΛݺͼग़͢ʹ Objective-C Λհ͢Δඞཁ͕͋Δ Objective-C export Objective-C
Λհ͞ͳ͍ Swift export ͕։ൃத Experimental Apple platform Ͱͷ KMP Λͬͨ։ൃऀମݧ্͕͢ΔݟࠐΈ 34