iosswiftxcodeswift-frameworkswift-modules

Module not found when adding a framework to an existing Xcode project


I have created a simple swift framework from scratch and was able to use it by adding the framework to a newly created app project. Just to test, I've also created just another app project and was able to use the same framework there as well. But when I add the framework to an existing project/workspace, I'm no longer able to build the app with the following error:

No such module 'TestFramework1'

I'm using Xcode 14.3 on Apple Silicon to create the test app and framework and validated many other possible solutions discussed here and here with the existing project to no avail:

  1. I'm building for iPhone Simulator, building for a device doesn't work either
  2. The framework is properly added to list of "Frameworks, libraries, content"
  3. I'm opening the workspace, not project
  4. I've added a search path to the framework and made it recursive
  5. I did a full project cleanup: removed derived data, pods folder, podlock, reinstalled pods and opened the workspace
  6. Find implicit Dependencies for my app scheme is on
  7. iOS Demployment target is the same on the main app and the framework (iOS 14)
  8. I'm not using use_frameworks! in my pod file, as instead I use use_modular_headers!
  9. Pods project "Build active architecture only" is set to NO

Framework setup:

App project setup:

Here it works fine for a newly created project: enter image description here

Here is the error with an existing project: enter image description here

What else should I check apart from the options defined above to make it work with the existing project?


Solution

  • Found the issue, if someone else hits the same. The existing app has configuration different from the one defined by the framework. That is why a new app worked well while an existing app was trying to use a custom configuration and wasn't able to build/find the framework. I created the same configuration for the framework to match my host app here and it started to work as expected:

    enter image description here