Packages only seem to work for the first platform?

I have a local package and swift algorithms added to the project. I first added them while working on the iOS target.

If I switch to other targets, the packages don't work, even if I clear the caches and resolve them again.

The import error says "no such module", yet if I go to add the package, it says it can't add it, because it already there.

I'm using Xcode 13.2.1.

Accepted Reply

I'm working with a number of multi-platform apps that have local packages, and sometimes have your problem because I'd forgotten key steps.

  1. For each Target (platform), build the Library (package) before building the main product of that target (e.g. MacOS). You will probably have to rebuild the Library (package) after any Clean Build Folder.
  2. For each target, at the General tab of the Target explorer, make sure you've included the library (package output) in the Frameworks, Libraries and Embedded Content. Each target needs to have the Library specified, not just once at the project level.
  3. I've had problems with local packages when I've included the source(s) in my app's project, rather than having the package in a separate directory and included in the app project.

Best wishes and regards, Michaela

  • Seems to have helped, thanks!

Add a Comment

Replies

I'm working with a number of multi-platform apps that have local packages, and sometimes have your problem because I'd forgotten key steps.

  1. For each Target (platform), build the Library (package) before building the main product of that target (e.g. MacOS). You will probably have to rebuild the Library (package) after any Clean Build Folder.
  2. For each target, at the General tab of the Target explorer, make sure you've included the library (package output) in the Frameworks, Libraries and Embedded Content. Each target needs to have the Library specified, not just once at the project level.
  3. I've had problems with local packages when I've included the source(s) in my app's project, rather than having the package in a separate directory and included in the app project.

Best wishes and regards, Michaela

  • Seems to have helped, thanks!

Add a Comment