kotlin-ios-framework-export-and-swift-interop
Installation
SKILL.md
iOS Framework Export and Swift Interop
Use this skill when designing, implementing, or reviewing the boundary between Kotlin Multiplatform shared modules and a native iOS app (iosApp / Xcode).
Goals
- Stable, minimal Swift-facing API
- Correct framework / XCFramework packaging
- Safe threading when Swift collects Kotlin flows
- Clear ownership of DI / startup helpers on
iosMain
Prefer official defaults
- Export shared logic as a framework consumed by Xcode; keep UI in SwiftUI when the project chose native iOS UI (
sharedLogicwithout forcing Compose onto iOS). - Use the Kotlin Multiplatform Gradle DSL for iOS targets (
iosArm64,iosSimulatorArm64, …) andbinaries.framework/ XCFramework aggregation as documented for your KGP version. - Prefer static frameworks when that matches the project’s Xcode integration (common with Compose Multiplatform samples); do not switch static/dynamic without a packaging reason.
- Keep the Swift-visible surface small: facades, presenters, immutable models — not every internal repository type.
Docs: https://kotlinlang.org/docs/multiplatform/multiplatform-ios-integration-overview.html