No such module 'MyImportedModule'

Hello,

I am having a problem with a custom Cordova plugin while migrating my project to Capacitor. Let me explain the situation:

My app builds correctly with Cordova, but not with our home-made plugin on iOS. The plugin has a third-party package (Swift package, not CocoaPod). On the Capacitor platform, we added the package in Xcode by going to General > Frameworks, Libraries,…> +.

However, when I build, my plugin, located in Pods > Development Pods > CordovaPlugins > CordovaMyPlugin > MoPlugin.swift, throws an error “No such module ‘MyImportedPackage’”.

We tried adding this dependency to the App project, Pods project, to the target Capacitor, CordovaPlugins, and both.

I also tried to add my dependency to Podfile, but I don’t know how to deal with its dependencies that have no CocoaPod support.

I hope I have been clear enough, and that someone could help me to fix this issue.

Thank’s

try these:

try removing pod dir and try installing them again.

while compiling the app with Xcode check the swift version, and take the lower swift version while building the app via Xcode.

if it still does not work then the custom plugin, you have to verify which swift version it’s compatible with.

thank’s,
I have already tried deleting/reinstalling the plugin in different ways, but without success
I am not familiar with the iOS environment, i don’t know in wich path xcode resolve libraries

i also tried to add the path of my library in build settings

my last solution is to add my plugin’s library to podfile, but some of his dependencies are package, not cocoapod.

I would know where is the right place to import third party dependencies of plugin (It’s a cordova plugin) ?

i think it would be imported in project: Pods, target: CordovaPlugins but i’m not sure.
as i just said, i try differents ways, but none worked.

if it’s a Cordova plugin, does your app, support Cordova or a capacitor, as the capacitor needs coca pod support which might be causing the issue?

It’s a Cordova plugin that works fine on Android, but on iOS, there’s an issue with importing its package dependency.

Before migration, we simply imported its Swift package dependency in the app project.

However, with Capacitor, we now have two projects in our workspace: App and Pods. I’ve tried importing the dependency in the App project, but there were no changes. I also tried importing it in Pods, with different targets (Capacitor, CordovaPlugins - a pod that wraps my Cordova plugin and some others), but the build still fails.

Before rewriting the plugin with Capacitor implementation, I’d like to know what the best practice is for importing a Swift package in a plugin, where to import it and why a swift file in le project cannot find an imported package.