SPM in project pre Xcode 11 - 'No Such Module'

Hi,

I've a issue with integrating swift packages into projects that were created via e.g. xcode 10 (pre 11).

I see added library in 'Swift Package Dependencies' correctly, it's in 'Frameworks, Libraries and Embedded Content' section of target's settings as well as in 'Link Binary With Libraries' section of 'Build Phases'


If I create a new project then everything works smothly. A few things that I've already tried:

- Copy swift package manualy (by drag and drop) into the project

- Add package via file://LocalURL

- I've compared info.plist, build settings and schemes beteen old and new project (Maybe I've missed something, my guess is that the issue is in build settings but I can't find it)


The result is always the same, if I import SPM library in any file I get an error "No such module 'ExampleFramework'"


Any ideas? Thanks in advance for any help

Answered by Zaba in 370348022

Ok so after various tries I've created new project, added files from the old one and during this I've encountered at identical situation, it turns out that the issue is not in build settings but rather in configuration.

You cannot build SPM with different configuration than 'Debug' and as in most of my projects I have multiple configurations, that why I wasn't able to use SPM in them.

Unfortunately I couldn't find a way to change target configuration, nevertheless I'm closing this thread, I hope that my explanation above will hope someone with the same issue

This is very helpful.

This is STILL happening in Xcode 12 beta-3. Unbelievable.
I just ran into a similar problem and discovered that my schemes referenced old configurations, configurations that no longer existed. Once I updated them to the correct configurations the build succeeded.
 
(I'm leaving this comment about a year later. It's possible that what I ran into is completely different from what was originally reported. Still, it took me quite a while to track the problem down, so I wanted to leave a note that might save others time.)
I had the same issue described above and I've been stuck for a few days on this. The comment of @mul did the trick. Thanks a bunch!
I can believe this issue is still there, using Xcode 12.4. I have this error too...
SPM in project pre Xcode 11 - 'No Such Module'
 
 
Q