capacitor-plugin-spm-support

Adds Swift Package Manager support to existing Capacitor plugins by replacing Objective-C bridges.

1|Updated Aug 25, 2026
One-click install
npx skills add https://github.com/involvex/ionic-everywhere --skill capacitor-plugin-spm-support-involvex
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: capacitor-plugin-spm-support
Source: https://github.com/involvex/ionic-everywhere/tree/main/.agents/skills/capacitor-plugin-spm-support
Command: npx skills add https://github.com/involvex/ionic-everywhere --skill capacitor-plugin-spm-support-involvex

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Capacitor plugins traditionally rely on CocoaPods and Objective-C bridge files for iOS integration, which blocks adoption of Swift Package Manager. This Skill guides the migration of an existing Capacitor plugin to SPM by generating a Package.swift manifest and replacing the Objective-C bridge with the CAPBridgedPlugin Swift protocol. ## Core Features & Use Cases - Package.swift Generation: Creates a complete SPM manifest with the correct pod name, iOS deployment target, Capacitor version branch, and third-party dependency mappings. - Objective-C Bridge Replacement: Converts the plugin class to the CAPBridgedPlugin protocol, migrating all CAP_PLUGIN_METHOD registrations into the pluginMethods array, then deletes the .h and .m files. - Project Cleanup: Removes stale references from project.pbxproj, updates .gitignore with SPM artifacts, and adds Package.swift plus an ios:spm:install script to package.json. - Use Case: You maintain a Capacitor 6 plugin whose users request SPM support. The Skill reads your podspec and plugin sources, resolves CocoaPods dependencies to SPM equivalents, and performs the full migration step by step. ## Quick Start Add Swift Package Manager support to my Capacitor plugin in this repository.

Frequently Asked Questions about capacitor-plugin-spm-support

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

FAQPage Schema
How do I add Swift Package Manager support to a Capacitor plugin?▼

Create a Package.swift manifest referencing the capacitor-swift-pm repository, convert the plugin class to the CAPBridgedPlugin protocol with identifier, jsName, and pluginMethods properties, then delete the Objective-C .h and .m bridge files and clean their references from project.pbxproj.

How to replace CAP_PLUGIN macro with CAPBridgedPlugin in Swift?▼

Add CAPBridgedPlugin conformance to the plugin class and declare identifier, jsName, and a pluginMethods array containing CAPPluginMethod entries for each method previously registered via CAP_PLUGIN_METHOD. Preserve each method's original return type such as CAPPluginReturnPromise.

What Capacitor version is required for SPM plugin support?▼

SPM support requires Capacitor 6 or later, along with Swift 5.9+ and Xcode 15+. The Package.swift must point to the capacitor-swift-pm branch matching the Capacitor major version, such as 6.0.0.

Can CocoaPods dependencies be converted to Swift Package Manager?▼

Many popular CocoaPods libraries like Firebase and Alamofire also distribute via SPM from the same repository, so you can reuse the Git URL with a converted version constraint. If no SPM equivalent exists, you must find an alternative package or vendor the dependency source.

Why does the Swift build fail with CAPBridgedPlugin not found?▼

This error means the Capacitor version is below 6 or the capacitor-swift-pm branch in Package.swift does not match the installed Capacitor major version. Verify peerDependencies in package.json and align the package branch accordingly.

When should this migration not be used?▼

Do not use it for Capacitor app projects, for creating new plugins from scratch, or for non-Capacitor frameworks. It also cannot complete if a required CocoaPods dependency has no SPM-compatible equivalent or alternative.