Foreign Function and Memory APIs and Swift/Java interoperability
summary
Concrete interoperability work connects Swift and Java using Foreign Function and Memory API (JDK22) with a JNI fallback, plus a jextract-swift generator that emits Java wrappers and Swift glue. It derives Swift type metadata and value witness table sizes at runtime to allocate dense structs, exposes initializers via C-calling-convention shims, and uses arena-based lifetimes (try-with-resources or GC-backed arenas) to keep memory-safe reference counting and predictable destruction. Early, experimental, server- and Android-focused; Java 25 is the targeted stable FFM release.
AI-written summary · about
chapters (9)
- 0:00Swift/Java interoperability
- 2:54Foreign Function and Memory APIs
- 6:06Java calling Swift
- 9:55Handling Swift types
- 12:28Initializing Swift types from Java
- 16:23Swift memory layouts
- 18:30Invoking Swift methods
- 20:56Memory management in Swift-Java
- 22:43Deep integration and future
related talks
11mExpanding Swift/Java Interoperability
40mHow Swift Runs on Android — Swift SDK for Android and KMP
41mThe Kotlin Swift boundary
36mSwift & Interoperability
31mSeamless Interoperability: Harnessing JNIGen and FFIGen
19mWhat's up with Swift 5
49mState of Swift Internals: Swift 4 & 5
33mKotlin Multiplatform Alchemy: Making Gold out of Your Swift Interop
