Dynamically share SPM dependency across frameworks


we have a complex app that consists of many plugins in the form of .framework. We use SPM to pull certain capabilities into separate frameworks. One of our common SPM dependencies is a Logging library, that defines a protocol for a Logger object that the rest of SPM dependencies use. When we link one SPM dependency into Engine and another SPM dependency into SharedKit, this is the result in the app folder:


As you can see, the logging framework is packed separately in each of the frameworks. I am not very proficient with SPM yet so this might be something trivial. Is there a way, how to tell Xcode/SPM to not pack any dependencies inside the .framework? I would like to set proper RUNTIME_SEARCH_PATHS so the framework find a shared Logging.framework that I will add directly to Contents/Frameworks folder.

I was not able to find any reading about what the _PackageProduct.framework is and why it is created instead of being statically linked into each of the frameworks.

Thanks in advance for any references/ideas/help.

1 Like