
Capacitor Plugin Spm Support
- 424 installs
- 57 repo stars
- Updated July 13, 2026
- cap-go/capgo-skills
capacitor-plugin-spm-support is an agent skill that adds Swift Package Manager support to existing Capacitor iOS plugins by creating Package.swift, converting to CAPBridgedPlugin, and updating package exports for develop
About
capacitor-plugin-spm-support is a cap-go skill for Capacitor plugin maintainers adding Xcode Swift Package Manager consumption alongside or instead of CocoaPods. The six-step procedure reads package.json, the podspec, and the main Swift plugin class, then creates Package.swift with iOS deployment target and Capacitor SPM dependencies, converts the plugin to CAPBridgedPlugin with identifier, jsName, and pluginMethods, removes Objective-C bridge files, updates package exports, and verifies via npx cap sync in the example app. The skill handles third-party CocoaPods dependencies by finding SPM equivalents or keeping mixed managers. Developers reach for capacitor-plugin-spm-support when a plugin needs Package.swift, CAPBridgedPlugin registration, or cleanup of legacy bridge headers—not for app projects or non-Capacitor frameworks.
- Package.swift structure for Capacitor plugins
- CocoaPods to SPM migration steps
- Xcode target and dependency alignment
- Publishing SPM-compatible plugin releases
- Compatibility notes for consumer apps
Capacitor Plugin Spm Support by the numbers
- 424 all-time installs (skills.sh)
- Ranked #329 of 1,039 Mobile Development skills by installs in the Skillselion catalog
- Data as of Aug 1, 2026 (Skillselion catalog sync)
npx skills add https://github.com/cap-go/capgo-skills --skill capacitor-plugin-spm-supportAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 424 |
|---|---|
| repo stars | ★ 57 |
| Last updated | July 13, 2026 |
| Repository | cap-go/capgo-skills ↗ |
How do you add SPM support to Capacitor plugins?
Add Swift Package Manager support to Capacitor iOS plugins, replacing or complementing CocoaPods for cleaner native dependency management.
Who is it for?
Capacitor plugin maintainers modernizing iOS native code from CocoaPods-only distribution to Swift Package Manager compatible packages.
Skip if: Skip capacitor-plugin-spm-support for Capacitor app projects, Android-only plugin work, or creating plugins from scratch without an existing iOS implementation.
When should I use this skill?
User wants Swift Package Manager on a Capacitor plugin, CAPBridgedPlugin conversion, Package.swift creation, or removal of Objective-C bridge files from ios/.
What you get
Package.swift manifest, CAPBridgedPlugin Swift class, removed bridge headers, updated package.json exports, and verified example app build.
- Package.swift
- CAPBridgedPlugin Swift class
- Updated package.json exports
By the numbers
- Defines a 6-step SPM migration procedure in SKILL.md
- Requires CAPBridgedPlugin identifier, jsName, and pluginMethods properties
- Verifies integration via npx cap sync in example app directory
Files
Add Swift Package Manager Support to a Capacitor Plugin
Add SPM support to an existing Capacitor plugin so it can be consumed without CocoaPods.
When to Use This Skill
- User wants a plugin to work through Xcode's package manager
- User is converting an existing iOS plugin from Obj-C bridge files to bridged Swift registration
- User needs the plugin package manifest and file exports updated for SPM
Procedures
Step 1: Gather Plugin Information
Read these files in the plugin root:
package.json- the
.podspec - the main Swift plugin class under
ios/
Record:
- the package name
- the pod name
- the iOS deployment target
- the plugin class name
- the JavaScript plugin name
- all exposed plugin methods
- any third-party CocoaPods dependencies that also need SPM equivalents
Step 2: Create Package.swift
Add a Package.swift manifest that:
- declares the plugin package name
- sets the iOS minimum version
- points the target at the plugin's iOS source directory
- depends on the Capacitor Swift package support package used by the project
- adds any resolved third-party SPM packages
Keep the target structure aligned with the actual plugin source tree.
Step 3: Convert the Swift Plugin Class
Update the plugin class to conform to CAPBridgedPlugin.
Add the bridge properties at the top of the class:
identifierjsNamepluginMethods
Preserve each method name and return type exactly as the plugin already exposes them.
Step 4: Remove Objective-C Bridge Files
Delete the old bridge header and implementation files once the Swift bridge is in place.
Then clean the Xcode project file so it no longer references them.
Step 5: Update Package Metadata
Update the plugin package manifest so it exports:
- the iOS sources
- the podspec
Package.swift
Add an iOS SPM install command if the project maintains script helpers.
Step 6: Verify
Install dependencies with the repository's existing package manager.
Then cd into the example or test app directory that contains capacitor.config.*, run npx cap sync (or the repository's equivalent runner) there, and build that same app.
Error Handling
- Start with the Swift package resolver: check the target path and package dependency names first.
- Verify bridge registration by matching the class name,
identifier, andjsNameagainst the exported API. - For unsupported CocoaPods dependencies, replace them with SPM-compatible packages or keep CocoaPods for that dependency.
{
"version": "1.0.0",
"organization": "Capgo",
"date": "March 2026",
"abstract": "Guide for adding Swift Package Manager support to an existing Capacitor plugin, including bridged Swift registration and package metadata updates.",
"triggers": [
"add spm support to capacitor plugin",
"swift package manager plugin",
"package.swift capacitor plugin",
"bridged plugin",
"capacitor plugin spm"
],
"references": [
"https://swift.org/package-manager",
"https://capacitorjs.com/docs"
]
}
Related skills
How it compares
Use capacitor-plugin-spm-support when distributing Capacitor plugins via SPM; keep CocoaPods-only workflows if all third-party native deps lack SPM equivalents.
FAQ
What files does capacitor-plugin-spm-support modify?
capacitor-plugin-spm-support reads package.json, the podspec, and the Swift plugin class, then adds Package.swift, updates the plugin class to CAPBridgedPlugin, deletes Objective-C bridge headers, and exports iOS sources plus manifests from package.json.
How does capacitor-plugin-spm-support verify SPM integration?
capacitor-plugin-spm-support runs dependency install with the repo package manager, then npx cap sync from the example or test app directory containing capacitor.config.* and builds that same app to confirm bridge registration.
Can capacitor-plugin-spm-support replace all CocoaPods dependencies?
capacitor-plugin-spm-support maps third-party CocoaPods to SPM-compatible packages when available. Unsupported pods may remain on CocoaPods while the plugin itself ships Package.swift for SPM consumers.