Andrey Yastrebov
10/22/2026, 10:16 AMkotlin { export { swift { ... } } }. There's no export(...) list anymore, because the dependency graph decides what's exported. A library sets its own moduleName and rootPackage (the old flattenPackage), and consumers pick them up automatically. A consumer can override them with configure(dependency) { ... } inside xcodeIntegration {} or swiftPackageIntegration {}, and can set a dependency's visibility to SwiftExportVisibility.EXPOSED or HIDDEN. The old swiftExport {} block is deprecated.
With swiftPackageIntegration {}, run ./gradlew :shared:exportDebugSwiftPackage (or exportReleaseSwiftPackage). You get a local Swift package with the generated Swift modules and the compiled Kotlin code as an XCFramework, which you add to Xcode or another package like any local dependency. It works alongside xcodeIntegration {}. The generated code needs iOS 18 or macOS 15, and in 2.5.0 it can't be combined with swiftPMDependencies {} (planned for 2.5.20).
The Swift Export sample now covers both, plus most Swift Export language features, with an iOS and macOS app and a Swift package that consumes the export: github.com/Kotlin/swift-export-sample
Feedback and bug reports are welcome in this thread or in YouTrack.Ahsan Ullah Rasel
10/23/2026, 3:09 AMswiftPackageIntegration {} on a real production KMP module (three modules, networking + domain, Ktor/Koin/Apollo) and consumed the package from an existing iOS app: it builds, links and runs, and the native enums, sealed types, typed errors and async functions are a big improvement over the ObjC framework. SwiftExportVisibility.HIDDEN on the internal libraries (Koin, Ktor, kotlinx-io/serialization) cut the generated Swift by about a quarter with config only. The only Swift-side change was dropping an alias to Kotlin’s CancellationException, which is fine since cancellation already arrives as CancellationError.
While porting I hit three bugs, all reproduced on 2.5.0-Beta2 with minimal repros attached:
• KT-90498: the generated bridge doesn’t compile for a suspend function-type parameter returning a generic class (suspend () -> Response<D>), which breaks the whole export
• KT-90497: member properties named description / hash / hashValue are silently dropped, and Swift then reads `NSObject`’s toString() / hashCode() instead. It compiles fine, so the wrong value is easy to miss
• KT-90499: a List<T?> created in Swift with nil elements crashes with “Could not cast value of type ‘NSNull’” when read back
One small thing: a dependency without a rootPackage logs “No name for packageRoot and will be ignored” many times (KT-90101).Andrey Yastrebov
10/23/2026, 8:10 AMGuilherme Delgado
10/26/2026, 11:45 AMswiftPackageIntegration() on 2.5.0-Beta2, the exported package (`exportDebugSwiftPackage`/`exportReleaseSwiftPackage`) builds and links fine in an Xcode app target when the app is built in Debug, but fails to link in Release:
Undefined symbols for architecture arm64:
"_KotlinRuntimeSupport_linkAnchor", referenced from:
_KotlinRuntimeSupport_ensureLinked in libComposablesKotlin.a[...](libROOT...a.o)
ld: symbol(s) not found for architecture arm64
The generated KotlinRuntimeSupport.swift inside the exported package does declare it:
// MARK: - Link anchor
/// Anchor that keeps this compilation unit in the linked image. Without it this module gets stripped
@_cdecl("KotlinRuntimeSupport_linkAnchor")
func _kotlinRuntimeSupportLinkAnchor() {}
Looks like the KotlinRuntimeSupport target gets dead-stripped by Xcode’s more aggressive Release optimization before the linker ever sees that libComposablesKotlin.a references that anchor. The generated Package.swift itself is correct and identical in structure between Debug/Release, only the build configuration changes.
Is this a known limitation, or worth filing as a new issue?Artem Olkov
10/26/2026, 12:39 PMGuilherme Delgado
10/26/2026, 1:54 PMArtem Olkov
10/27/2026, 8:20 AMGuilherme Delgado
10/27/2026, 9:15 AMGuilherme Delgado
10/27/2026, 9:15 AMGuilherme Delgado
10/27/2026, 9:26 AMArtem Olkov
10/27/2026, 9:29 AMArtem Olkov
10/27/2026, 9:31 AMkotlin find-kotlin-dev-build.main.kts 2.5.20 --dev --latestGuilherme Delgado
10/27/2026, 9:33 AMAndrey Yastrebov
10/27/2026, 9:57 AM// Workaround for KT-90738 (fixed in 2.5.20-Beta1): make the link anchor `package` so Release links.
tasks.withType<Sync>().named { it == "exportReleaseSwiftPackage" }.configureEach {
doLast {
val anchor = destinationDir.resolve("Sources/KotlinRuntimeSupport/KotlinRuntimeSupport.swift")
anchor.writeText(anchor.readText().replace("\nfunc _kotlinRuntimeSupportLinkAnchor", "\npackage func _kotlinRuntimeSupportLinkAnchor"))
}
}Guilherme Delgado
10/28/2026, 10:21 AMGuilherme Delgado
11/02/2026, 11:34 AM