-
Notifications
You must be signed in to change notification settings - Fork 0
Bridging Swift Kotlin
Ali Sadeghi edited this page Jan 21, 2026
·
4 revisions
Auto-activates when: User mentions "Swift bridge", "iOS integration", "native SDK"
Uses interface injection to integrate iOS-specific SDKs while maintaining Clean Architecture.
1. Define Kotlin interface (commonMain)
2. Implement in Kotlin (androidMain) - usually stub
3. Implement in Swift (iosMain via expect/actual)
4. Inject via Koin DI
> Integrate iOS Face ID authentication into the login featureGenerates:
// commonMain - Interface
interface BiometricAuthenticator {
suspend fun authenticate(reason: String): Either<Boolean>
}
// androidMain - Android implementation
actual class BiometricAuthenticatorImpl : BiometricAuthenticator {
override suspend fun authenticate(reason: String): Either<Boolean> {
// Android BiometricPrompt implementation
}
}
// iosMain - expect/actual bridge
expect class BiometricAuthenticatorImpl() : BiometricAuthenticator
// iosMain Swift bridge
@Composable
actual fun rememberBiometricAuthenticator(): BiometricAuthenticator {
return remember { BiometricAuthenticatorSwiftBridge() }
}// Swift implementation
class BiometricAuthenticatorSwiftBridge: BiometricAuthenticator {
func authenticate(reason: String) async -> Either<Bool> {
let context = LAContext()
// Face ID implementation
}
}> Add iOS camera capture to the profile photo feature> Integrate Apple Pay into the checkout feature> Add iOS push notification handling to the messaging featureWhen adding bridges to existing features:
- Checks for
.claude/docs/{feature}/spec.md - If spec exists: drafts spec updates for bridge interfaces
- Updates spec's Integration Points section after implementation
Back to Skills