If something kept me very busy and excited, it was writing a regex interpreter.
I was doing it before learning how an interpreter actually works - absolute no "how to build a regex interpreter tutorial". Because that would spoil the fun - and everyone can do it. 😄
But if you want to...
.
For actual Android apps (not just CLI tools), Swift modules are compiled as shared libraries (
.so) and bundled into the.apk. The bridge isswift-java- an official Swiftlang project that handles JNI (Java Native Interface) automatically:swift-java-jni-corefor advanced useSo your Android Activity (Kotlin) can load a Swift
.soand call into it like any native library, and Swift can reach back into Android APIs. The Gradle build integrates with Swift Package Manager for dependency management.In a Nutshell
(3/4)
It's not Swift running on the JVM or transpiled to Java. It's the Swift compiler emitting native ARM64 ELF binaries, linked against Android's libc/bionic, with a JNI bridge layer for app-level interop. Performance is comparable to C++ via the NDK.
Your
DevPlaceSwiftSDKwould compile as a static/dynamic Swift library foraarch64-unknown-linux-android28, get wrapped in a thin JNI layer, and any Android app (Kotlin/Java) could call it. Should work with SwiftAndroid too since it's the same target triple.(4/4)
snek's answer was also interesting for me since I didn't know the technical details myself.