Swift Export issues with Kotlin 2.3.10 — cinterop, name mangling, StackOverflow
Hi, I’m testing Swift Export on a large KMP project and hitting three blockers. Would appreciate any guidance.
Environment: Kotlin 2.3.10, Gradle 9.0, targets: iosArm64 / iosSimulatorArm64 / macosArm64
---
1. cinterop typealias not supported
We have an expect/actual type where the Apple actual is a cinterop typealias:
// commonMain
expect class LatLng
// appleMain
actual typealias LatLng = SomeObjCType // from cinterop
Any module exposing this in its public API fails when included in swiftExport { export(...) }:
Can’t translate return type in fun toLatLng():
cinterop.SomeObjCType:
Symbol not found for
cinterop/SomeObjCType
This type is used across most of our modules, so nearly everything is blocked.
❓ Is there a way to make Swift Export handle cinterop types, or exclude specific types/functions from export?
---
2. Name mangling failure for Companion / Builder
Classes with Companion objects or Builder inner classes consistently fail:
Failed to mangle name for bridging class
ModuleName.
ExportedKotlinPackages..._SomeClass_Companion: KotlinRuntime.KotlinBase
---
3. StackOverflowError with multiple modules
Combining several modules in swiftExport { export(...) } causes:
java.lang.StackOverflowError (no error message)
Possibly due to circular type references between modules.
---
✅ What works: Simple modules with basic interfaces and enums export correctly and generate valid Swift bindings.
Any workarounds or roadmap info would be very helpful. Thanks!