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
110
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
330
App内課金におけるトラブルを劇的に減らすための取り組み
kokihirokawa
2
1.2k
ABEMAのリアーキテクチャ
kokihirokawa
5
5.1k
Detect Body and Hand Pose with Vision
kokihirokawa
0
920
Other Decks in Technology
See All in Technology
GA technologiesでのAI-Readyの取り組み@DataOps Night
yuto16
0
230
Pythonによる契約プログラミング入門 / PyCon JP 2025
7pairs
4
2.2k
"複雑なデータ処理 × 静的サイト" を両立させる、楽をするRails運用 / A low-effort Rails workflow that combines “Complex Data Processing × Static Sites”
hogelog
3
1.3k
GC25 Recap+: Advancing Go Garbage Collection with Green Tea
logica0419
1
300
Sidekiq その前に:Webアプリケーションにおける非同期ジョブ設計原則
morihirok
17
6.2k
API提供者のためのMCPサーバー設計ガイド / MCP Server Design Guide for API Providers
yokawasa
0
230
Go Conference 2025: GoのinterfaceとGenericsの内部構造と進化 / Go type system internals
ryokotmng
3
530
FastAPIの魔法をgRPC/Connect RPCへ
monotaro
PRO
0
470
全てGoで作るP2P対戦ゲーム入門
ponyo877
3
1.2k
Windows で省エネ
murachiakira
0
140
stupid jj tricks
indirect
0
7.5k
いまさら聞けない ABテスト入門
skmr2348
0
170
Featured
See All Featured
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
46
7.6k
The Straight Up "How To Draw Better" Workshop
denniskardys
237
140k
Become a Pro
speakerdeck
PRO
29
5.5k
Designing for Performance
lara
610
69k
Designing Experiences People Love
moore
142
24k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
8
560
Optimizing for Happiness
mojombo
379
70k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.6k
Music & Morning Musume
bryan
46
6.8k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
53
3k
The Cult of Friendly URLs
andyhume
79
6.6k
The Language of Interfaces
destraynor
162
25k
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