Skills

Kotlin Tooling Cocoapods Spm Migration

Migrate KMP projects from CocoaPods (kotlin("native.cocoapods")) to Swift Package...

Install

npx skills add Kotlin/kotlin-agent-skills --skill kotlin-tooling-cocoapods-spm-migration -g -a claude-code -y
Category
Mobile
Updated
5d ago
License
Apache-2.0
Context cost
Mediumabout 3,000 tokens
Runs scripts
No, instructions only

What it does

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.

CocoaPods to SwiftPM Migration for KMP

Migrate Kotlin Multiplatform projects from kotlin("native.cocoapods") to swiftPMDependencies {} DSL.

Requirements

  • Kotlin: 2.4.0-Beta2 or later (first public release with swiftPMDependencies support, available on Maven Central)
  • Xcode: 16.4 or 26.0+
  • iOS Deployment Target: 16.0+ recommended

Migration Overview

IMPORTANT: 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.

PhaseAction
1Analyze existing CocoaPods configuration
2Update Gradle configuration (repos, Kotlin version)
3Add swiftPMDependencies {} alongside existing cocoapods {}
4Transform Kotlin imports
5Reconfigure iOS project and deintegrate CocoaPods
6Remove CocoaPods plugin from Gradle
7Verify Gradle build and Xcode project build
8Write MIGRATION_REPORT.md

Phase 1: Pre-Migration Analysis

1.0 Verify the project builds

Before starting migration, identify the module to migrate and confirm it compiles successfully.

  1. Find the module that uses CocoaPods, look for build.gradle.kts files containing cocoapods:
    grep -rl "cocoapods" --include="build.gradle.kts" .
    
    Extract the module name from the path (e.g., ./shared/build.gradle.kts → module name is shared). Note: multiple modules may use CocoaPods, record all of them. Typically only the module that produces the framework linked into the iOS app needs swiftPMDependencies; the others only need CocoaPods removed (Phase 6).
Read the whole SKILL.md on GitHub

More in Mobile