← ClaudeAtlas

bridge-swiftsolid

Bridge Swift to Kotlin Multiplatform via Interface Injection. Use when integrating iOS SDKs, calling Swift from Kotlin, accessing iOS-only APIs, implementing biometrics/payments/camera, or connecting native frameworks to KMP.
ThisIsSadeghi/KMPilot · ★ 37 · AI & Automation · score 78
Install: claude install-skill ThisIsSadeghi/KMPilot
# Bridge Swift Kotlin interface in `iosMain` → Swift implements it in `iosApp` → Inject via Koin DI. **Architecture Reference:** @../_shared/patterns.md ## When you arrive here This skill is the **iOS-Swift leg** of the Rule 14 platform path (`@../create-feature/architecture/platform.md`). Reach it when a feature's iOS `actual` can't be written cleanly in Kotlin/Native and needs a Swift class. `/create-feature` and `/modify-feature` finish the Kotlin side (the `commonMain` interface + Android/desktop actuals + `expect/actual val platformModule`) and then route the user here — they never call this skill directly. Android almost never needs a bridge (Kotlin calls the Android SDK directly), so this is iOS-specific. The Provider-wraps-bridge-in-`Either<T>` pattern below is the same DataSource contract platform.md describes. ## Critical: Swift Inheritance Swift class inherits from `<ModulePrefix><InterfaceName>`: | Module | Kotlin | Swift Inherits | |--------|--------|----------------| | `core:data` | `RecaptchaBridge` | `DataRecaptchaBridge` | | `feature:auth` | `AuthBridge` | `AuthAuthBridge` | Use Xcode autocomplete (`Ctrl+Space`) to find exact protocol name. ## Implementation Steps ### 1. Bridge Interface (`iosMain`) ```kotlin // <module>/src/iosMain/kotlin/{PKG_PREFIX}/<feature>/<Feature>Bridge.kt interface <Feature>Bridge { suspend fun execute(param: String): String } ``` ### 2. Provider (`iosMain`) ```kotlin // <module>/src/iosMain/kotlin/{PKG_PREFIX}/<featur