Plugin Development: Include third party native xcframework's

I am creating a plugin. Using the npm init @capacitor/plugin@latest command. This created a very small folder which include the following:

  • a Package.swift file
  • a [Echo]Pluing.podspec file ([Echo] replaced by my plugin name)
  • an iOS folder with two files inside (Echo.swift and EchoPlugin.swfit)

I would now like to import some custom xcframework’s in this plugin project so that I can use it in the Echo.swift file. But I cannot find anywhere how this is done. All I can find is adding GitHub dependencies. I just have the real binary packages without a version specified. These I put inside the iOS/SdkFrameworks folder (the latter I created myself)

EDIT: A lot of resources online are talking about the pod file or a POD project/target. But I do not have that. All I have is the podspec and package.swift

Capacitor plugins are both CocoaPods libraries and Swift Package Manager packages.

If the app using your plugin is still using CocoaPods you have to add the xcframework as vendored_frameworks in your .podspec file

If the app using your plugin is using SPM, then you have to add the xcframework in the Package.swift

It’s recommended to do both if you plan to share the plugin with the community.