Linking 3rd party swift packages

I am creating a capacitor plugin that wraps a 3rd party SDK. For IOS the SDK is available as a swift package. I am able to link the package to my plugin using the Package Dependencies tab in XCode after I build the app, but each time I build or run npx cap sync I need to relink the package.

I am wondering if there is a way to do this automatically with a build script or some other way so it doesn’t need to be done manually after each build.

New plugins now include a Package.swift file where you can add swift packages as dependencies, but it will only work if users are using the Capacitor’s SPM template.

If you want to use CocoaPods, I found this package that allows to specify SPM dependencies inside the podspec file, but users will have to install that package for it to work.