kmp-ios-interop-fixer

Diagnose and fix Kotlin-to-Swift interop issues in Kotlin Multiplatform shared modules.

Updated Jan 2, 2024
One-click install
npx skills add https://github.com/Mithrandir21/game-deals-app --skill kmp-ios-interop-fixer-mithrandir21
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: kmp-ios-interop-fixer
Source: https://github.com/Mithrandir21/game-deals-app/tree/main/.claude/skills/kmp-ios-interop-fixer
Command: npx skills add https://github.com/Mithrandir21/game-deals-app --skill kmp-ios-interop-fixer-mithrandir21

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Kotlin Multiplatform generates the Swift-facing API automatically, and the result is often ugly or broken: mangled method names, missing default arguments, sealed classes that don't map to Swift enums, Flow without async/await, and functions that vanish from the Objective-C header. This Skill diagnoses the exact interop limitation behind each symptom and applies the standard upstream fix in the Kotlin API. ## Core Features & Use Cases - Header-driven diagnosis: Builds the iOS framework and reads the generated Objective-C header to see exactly what Swift sees before guessing at causes. - Symptom-to-fix mapping: Covers overload renaming, default arguments, sealed class bridging, Flow/suspend exposure, generics erasure, @HiddenFromObjC, Result bridging, and @Throws exception handling. - Tooling guidance: Recommends SKIE or KMP-NativeCoroutines where they fix categories of problems automatically, plus guardrails like iOS compile tests to catch regressions. - Use Case: The iOS team reports that a suspend function appears as a completion-handler method and a sealed class shows up as plain classes. Use this Skill to identify the interop limitation, adopt SKIE, and verify the regenerated header exposes Swift-native async functions and enums. ## Quick Start Ask the assistant to diagnose why Swift cannot see or cleanly call a specific Kotlin API in your KMP shared module and apply the appropriate interop fix.

Frequently Asked Questions about kmp-ios-interop-fixer

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I expose Kotlin suspend functions to Swift as async?▼

Raw KMP interop exposes suspend functions as completion-handler methods. Adopt SKIE or KMP-NativeCoroutines to surface them as native Swift async functions, or wrap calls manually with withCheckedContinuation on the Swift side.

How do I make Kotlin sealed classes appear as Swift enums?▼

By default, sealed classes bridge as an Objective-C base class with subclasses, requiring is-checks and downcasts in Swift. SKIE converts sealed classes into native Swift enums automatically; without it, expose a reshaped API instead.

SKIE vs KMP-NativeCoroutines for Flow interop?▼

Both expose Flow as Swift AsyncSequence and suspend functions as async. SKIE applies broadly via compiler plugin and also fixes sealed classes and default arguments; KMP-NativeCoroutines works via @NativeCoroutines annotations on specific declarations.

Why does my Kotlin function not appear in the Objective-C header?▼

Functions disappear when they are internal, annotated with @HiddenFromObjC, or hidden by SKIE for unsupported features. Check visibility modifiers and the SKIE report under build/skie/ to see what was hidden and why.

Why do Kotlin default arguments not work in Swift?▼

Kotlin default parameter values do not bridge through Objective-C, so Swift sees all parameters as required. Add manual overloads for each default combination, or adopt SKIE which preserves default arguments in the generated Swift API.

Why does a Kotlin exception crash my iOS app instead of throwing?▼

Kotlin functions need the @Throws annotation to bridge as Swift throwing functions. Without it, an uncaught Kotlin exception terminates the iOS app rather than being delivered to Swift as a catchable error.