Hello, Jetbrains is actually working on the kotlin...
# swift-export
u
Hello, Jetbrains is actually working on the kotlin Swift bridge, will this mean that we will be able to do Swift ui in kotlin? Or will it only be in one direction? https://blog.jetbrains.com/kotlin/2024/10/kotlin-multiplatform-development-roadmap-for-2025/#kotlin-to-swift-export
👀 3
a
Hello there. I would like to highlight the difference in used words. We do work on the Swift-Export project, meaning that we are building a solution to allow using Kotlin code from Swift code. We do not work on the Swift-Bridge or Swift-Interop, as they include the mirrored project - Swift-Import(meaning using swift code from kotlin code).
will it only be in one direction?
So yes, current solution will only allow the export of Kotlin symbols into swift codebase.
👍 3
j
This is great to know! 😊 so, this will address only part of the discussion https://kotlinlang.slack.com/archives/C073GUW6WN9/p1733951298533669?thread_ts=1727356177.985559&cid=C073GUW6WN9. The swift-java project contains JavaKit, which allows using Java from Swift. If I understand correctly, you’re working on something similar for Kotlin?
c
From what I can read,
swift-java
runs a JVM alongside Swift, and uses JNI to communicate between each other. This is a very different approach to the Kotlin bridge, where Kotlin is compiled to LLVM bytecode, which is the same as Swift. At runtime, there is no memory boundary, both languages are running using the exact same technology.
👌 1
a
JavaKit, which allows using Java from Swift
something similar for Kotlin
Well, allow me to talk a little bit about the differences The work you are referencing aims to allow programs to talk between JVM and Swift managed environments. If we take a look at sources of JavaKit - we will discover, that as an input for translation they accept compiled
.jar
. So, no, JavaKit does not allow using Java-lang from swift, it allows using Java Archives from swift. That in turn mean, that anything producing valid JAR file would be interoperable(but only one way) with swift through JavaKit. Including, I guess, Kotlin/JVM. Notice, that not a single test case is written for jar files built with non-Java sources as input, but nevertheless - it should still be possible. Main idea behind previous paragraph is that work you are referencing aims to befriend Java VM with natively compiled Swift. The project of Swift-Export does not target Kotlin/JVM. It currently targets Kotlin/Native, as it is the backend used by iOS developers.