All skills
kotlin avatar

/kotlin-tooling-cocoapods-spm-migration

@7429a68 official
by kotlinkotlin/kotlin-agent-skills1.1k stars
42

Migrate KMP projects from CocoaPods (kotlin("native.cocoapods")) to Swift Package Manager (swiftPMDependencies DSL) — replaces pod() with swiftPackage(), transforms cocoapods.* imports to swiftPMImport.*, and reconfigures the Xcode project.

Use this Skill: https://skilld.dev/gh/kotlin/kotlin-agent-skills/kotlin-tooling-cocoapods-spm-migration

This session only. Nothing lands on disk.

referencescocoapods-extras-patterns.md

≈991 tokens on demand. Your agent reads this file only when SKILL.md points to it.

CocoaPods Extras Patterns

Patterns to look for in build.gradle.kts files beyond the standard cocoapods {} block. These are workarounds, hacks, and glue code that projects accumulate over time to work around CocoaPods limitations.

Detection Patterns (Phase 1 step 11)

  • Custom tasks that hook into CocoaPods tasks — e.g., tasks registered with tasks.named("podInstall") { finalizedBy(...) } or tasks.register("fixXcodeProject") that patch Pods.xcodeproj/project.pbxproj to fix paths, tweak build settings, or work around CocoaPods quirks. These are pure CocoaPods workarounds and become dead code after migration.
  • Pods.xcodeproj patching — any code that reads/writes Pods.xcodeproj files (e.g., replacing Gradle invocation paths, fixing scheme settings). The Pods.xcodeproj will no longer exist after migration.
  • cocoapods.summary, cocoapods.homepage, cocoapods.version, cocoapods.name — podspec metadata (safe to remove)
  • cocoapods.podfile — explicit Podfile path reference
  • cocoapods.extraSpecAttributes — custom podspec attributes
  • pod("...", extraOpts = ...) or pod("...", moduleName = ...) — non-standard pod configurations
  • noPodspec() — disables podspec generation
  • Any code referencing Pods/ directory, .xcworkspace, or podspec files — build logic, path constants, or task inputs/outputs tied to CocoaPods artifacts
  • Compiler flags or linker settings added specifically for CocoaPods interop (e.g., -framework, cinterop defFile for pod headers)

Phase 6.4 Cleanup Categories

Safe to remove (no user consultation needed)

  • cocoapods.summary, cocoapods.homepage, cocoapods.version, cocoapods.name — podspec metadata, not used by SPM
  • cocoapods.podfile = project.file(...) — Podfile path reference, not used by SPM
  • cocoapods.extraSpecAttributes — podspec attributes, not used by SPM
  • noPodspec() — podspec generation flag, not used by SPM
  • Custom Gradle tasks that hook into CocoaPods tasks (podInstall, podSetup, generatePodspec) — these tasks no longer exist without the plugin. This includes any tasks registered via tasks.named("podInstall") { finalizedBy(...) } or similar wiring. Example of dead code to remove entirely:
    // REMOVE — CocoaPods workaround, no longer needed
    tasks.register("fixXcodeProject") {
        doLast {
            val xcodeProjectFile = project.file("../iosApp/Pods/Pods.xcodeproj/project.pbxproj")
            // ... patching Pods.xcodeproj paths ...
        }
    }
    tasks.named("podInstall") { finalizedBy("fixXcodeProject") }
  • Any code that reads/writes Pods.xcodeproj files — the Pods/ directory will no longer exist
  • References to Pods/ directory paths, .xcworkspace files, or podspec files in build configurations

Requires analysis — consult the user if unsure

  • pod("...", extraOpts = ...) — extra options may indicate special compilation flags needed. Check if the underlying library needs equivalent flags in swiftPMDependencies (e.g., importedClangModules, platform constraints)
  • pod("...", moduleName = ...) — custom module name may indicate the Clang module name differs from the pod name. This likely maps to an importedClangModules entry in the SPM package declaration
  • Custom cinterop defFile configurations for pod headers — these may need to be adapted or may no longer be needed if the SwiftPM import handles the headers automatically. Present findings to the user before removing
  • Compiler or linker flags added specifically for CocoaPods interop (e.g., -framework Pod, custom cinterops {} blocks) — analyze whether the SPM integration handles this automatically. If unclear, present the flags to the user and ask whether they are still needed
  • Any custom task wiring or build logic that references CocoaPods outputs — explain what the task does and ask the user whether equivalent functionality is needed

Source: SKILL.md on GitHub

No alerts16d4 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    This skill automates the migration of Kotlin Multiplatform (KMP) projects from CocoaPods to Swift Package Manager (SPM). It handles project analysis, Gradle configuration updates, Kotlin import transformations, and Xcode project reconfiguration. While the migration process involves modifying environment security settings (such as disabling Xcode's User Script Sandboxing) and executing complex build commands, these actions are standard requirements for the KMP toolchain and are performed as part of the tool's intended migration functionality.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 7429a68. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 3 weeks ago.

Activeupdated 5 months ago
metadata
{
  "author": "JetBrains",
  "version": "1.0.0"
}
  • kotlin
  • kmp
  • cocoapods
  • swift-package-manager
  • ios
  • migration
  • xcode
  • gradle
  • multiplatform

README badge

README badge for kotlin/kotlin-agent-skills/kotlin-tooling-cocoapods-spm-migration

Migrates Kotlin Multiplatform projects from CocoaPods to Swift Package Manager by replacing the kotlin("native.cocoapods") plugin with swiftPMDependencies DSL. Requires Kotlin 2.4.0-Beta2 or later and Xcode 16.4+, and includes a phased workflow that reconfigures the iOS project and removes CocoaPods dependencies once SwiftPM is integrated.

Generated from the current SKILL.md.

What Kotlin version does this skill require?
Kotlin 2.4.0-Beta2 or later. The skill will upgrade your project automatically if you're on an older version, but warns that version jumps across minor versions can introduce unrelated breaking changes.
Can I remove CocoaPods during the migration, or do I need to keep it?
Keep the `cocoapods {}` block and plugin active until Phase 6. The migration adds `swiftPMDependencies` alongside the existing CocoaPods setup first, reconfigures Xcode, and only then removes CocoaPods.
Does this work with third-party KMP libraries that bundle CocoaPods klibs?
Yes. The skill detects existing bundled klibs (e.g., from KMPNotifier) and skips generating new bindings for those modules, keeping their `cocoapods.*` imports unchanged.
What if my project has CocoaPods dependencies not declared in the Gradle `cocoapods {}` block?
The skill cross-references the Podfile against the Gradle block and flags any Podfile-only dependencies that must be migrated to `swiftPMDependencies` to avoid runtime linkage errors.
Do I need to update other dependencies or the Gradle wrapper during this migration?
No. The skill only updates the Kotlin version (if needed) and adds SwiftPM configuration. Other dependency or Gradle wrapper updates are out of scope and should be done separately.

Generated from the current SKILL.md. These answers refresh after source changes.