<https://github.com/swiftlang/swift-java> Will th...
# swift-export
s
https://github.com/swiftlang/swift-java Will this make kotlin interop easier?
đź‘€ 2
f
I didn’t know this one
this project is at early stage, so wait and see...
j
No. This is for the JVM.
👍 2
r
It's the opposite. It would presumably be helpful if you want to write Swift for Android instead of Kotlin for iOS.
j
Well, not Android, because Swift to Java depends on Project Panama's new FFI so you're JDK 22+ only.
That being said, someone could write a JNI-based solution here as well. You'd have to use SwiftSyntax to parse the swift and find all the annotated points and then generate all the yucky JNI code as well as honor whatever calling convention they've defined. I would assume the annotations are a shortcut to the regular C calling convention since they build on top of jextract rather than use their own tool.
But then you've always been able to expose a C ABI from Swift and call it via JNI. That's nothing new. The only new thing here is the automated tooling and that automated tooling is JDK 22+ only.
👍 3
r
yeah that's fair. I know of at least one team that's been running Swift on Android since 2018. I was assuming the new tooling would make that easier but didn't realize the JDK 22 requirement
👍 1
j
What is the state of swift/ios interop today ? In recent weeks, the swift-java project has seen growth. I wonder if anyone has revisited its interoperability potential, especially with Kotlin, given the following updates: • The extract tool might eventually support generating legacy-compatible sources that wouldn’t require JEP-454, instead leveraging existing JNI facilities. However, the current focus remains on modern foreign function and memory APIs. • There’s ongoing work to make it Android-compatible (PR #144), and the repository seems to incorporate Kotlin dependencies. • Swift binaries themselves are now building and running on Android (documentation). • People use this project to create stuff like FlutterSwift I know much of this may seem like conjecture or anecdotal evidence, but do you think this points to a trend toward making Swift more interoperable with Kotlin in the future?