kmp-xcframework-spm

Builds an XCFramework from a Kotlin Multiplatform shared module and publishes it as a Swift Package Manager binary target.

2|Updated Jun 6, 2026
One-click install
npx skills add https://github.com/ronjunevaldoz/kmp-agent-skills --skill kmp-xcframework-spm-ronjunevaldoz
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: kmp-xcframework-spm
Source: https://github.com/ronjunevaldoz/kmp-agent-skills/tree/main/skills/kmp-xcframework-spm
Command: npx skills add https://github.com/ronjunevaldoz/kmp-agent-skills --skill kmp-xcframework-spm-ronjunevaldoz

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Distributing Kotlin Multiplatform shared code to iOS teams is painful when iOS developers must install Kotlin and Gradle just to build the shared module. This Skill packages the KMP shared module as a pre-built XCFramework and distributes it through Swift Package Manager, so iOS developers consume it like any native Swift dependency. ## Core Features & Use Cases - XCFramework Build Configuration: Configures the Gradle assembleXCFramework task with static frameworks for iosArm64 and iosSimulatorArm64 targets. - Local SPM for Development: Creates a local Package.swift binary target pointing at the built XCFramework for fast iteration during development. - Remote SPM Distribution: Zips the XCFramework, computes the SHA-256 checksum, uploads it to GitHub Releases, and publishes a versioned Package.swift binary target. - CI Automation: Provides a GitHub Actions release workflow that builds, zips, checksums, updates Package.swift, and creates the GitHub Release on tag push. - Use Case: Your iOS teammate needs the latest shared networking layer. Tag v1.0.0, let CI publish the XCFramework zip to GitHub Releases, and Xcode resolves the updated SPM package automatically—no Kotlin toolchain required on their machine. ## Quick Start Ask the agent to configure the shared module to build a release XCFramework and set up a Swift Package Manager binary target published via GitHub Releases.

Frequently Asked Questions about kmp-xcframework-spm

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

FAQPage Schema
How do I build an XCFramework from a Kotlin Multiplatform module?▼

Configure an XCFramework in the shared module's build.gradle.kts by registering each iOS target's framework binary with the XCFramework object, then run ./gradlew :shared:assembleSharedReleaseXCFramework. The output lands in shared/build/XCFrameworks/release/.

How to distribute a Kotlin Multiplatform framework via Swift Package Manager?▼

Zip the built XCFramework, compute its checksum with swift package compute-checksum, upload the zip to GitHub Releases, and reference the URL and checksum in a Package.swift binaryTarget. Xcode resolves it like any SPM dependency.

SPM binary target vs CocoaPods for Kotlin Multiplatform—which should I use?▼

SPM binary targets are the recommended default because iOS developers need no Kotlin or Gradle toolchain and Xcode resolves them natively. Use CocoaPods only when the iOS project already depends on CocoaPods and migration is not feasible.

Why does Xcode reject my SPM binary target or use a cached version?▼

This happens when the checksum in Package.swift does not match the actual zip archive's SHA-256. Regenerate the checksum with swift package compute-checksum after every rebuild and update Package.swift on each release.

Can I use a local XCFramework path in Package.swift for development?▼

Yes, a binaryTarget can point to a local relative path for development, letting you iterate without publishing releases. Rebuild the XCFramework after Kotlin changes and clean the Xcode build folder to pick up the new binary.

Which iOS targets should a KMP XCFramework include?▼

Include iosArm64 for devices and iosSimulatorArm64 for Apple Silicon simulators; omitting the simulator slice prevents builds on Apple Silicon Macs. The iosX64 Intel simulator target is increasingly unnecessary.