Xcode / SPM integration issue—Xcode bundles frameworks into Swift Package frameworks that shouldn't have them

Xcode 12.5 added the ability for Xcode to automatically decide whether to use .dynamic or .static for the product type for a given Swift package when it builds it, based on whether it's used in multiple places or only in one place.

So I tried removing .dynamic throughout our app's 50+ local Swift packages. Afterwards, the app builds and runs fine.

However when trying to submit to the app store (test flight upload), we are getting rejected due to the fact that Xcode has now bundled every package dependency of a package into that package's framework's Frameworks folder, such that now there are 3, 4, and even 5 copies of each Swift package build product bundled in the app, nested inside of all the other frameworks and packages.

So for example, with a PackageA that's depended on by PackageB, that's depended on by PackageC, etc., previously when we manually specified ".dynamic," the app would have a directory structure like this:

App/
    Frameworks/
        PackageA.framework/
        PackageB.framework
        PackageC.framework
        XcodeProjectA.framework
        XcodeProjectB.framework
        XcodeProjectC.framework

However after removing "type: .dynamic" and letting Xcode infer, now Xcode builds an app with the following structure which gets rejected by the App Store for having duplicate bundles and Framework folders where they don't belong:

App/
    Frameworks/
        PackageA_3357E3B0B2AD110B_PackageProduct.framework/
        PackageB_AF8320FD902BA919_PackageProduct.framework/
            Frameworks/
                PackageA_3357E3B0B2AD110B_PackageProduct.framework/
        PackageC_182819ADFA392304_PackageProduct.framework/
            Frameworks/
                PackageA_3357E3B0B2AD110B_PackageProduct.framework/
                PackageB_AF8320FD902BA919_PackageProduct.framework/
        XcodeProjectA.framework
            Frameworks/
                PackageA_3357E3B0B2AD110B_PackageProduct.framework/
                PackageB_AF8320FD902BA919_PackageProduct.framework/
                PackageC_182819ADFA392304_PackageProduct.framework/
        XcodeProjectB.framework
            Frameworks/
                PackageA_3357E3B0B2AD110B_PackageProduct.framework/
        XcodeProjectC.framework
            Frameworks/
                PackageA_3357E3B0B2AD110B_PackageProduct.framework/
                PackageB_AF8320FD902BA919_PackageProduct.framework/
                PackageC_182819ADFA392304_PackageProduct.framework/

etc. etc. ... leading to there being many copies of the same framework embedded in the app.

However we don't have any "embed frameworks" build phases that should be responsible for this happening. And I don't see any way to force or compel Xcode not to bundle all these extra frameworks into the app.

I realize this isn't an Xcode support forum, but also, I don't know whether this is an Xcode bug or an SPM bug. Either way, I'm hoping maybe someone here knows why this would be happening, and if so, how to fix it.

BTW I did google extensively to try to find a solution, but no dice. I'm guessing my org is the only one actually trying to use SPM for locally-declared projects like this?

... Thanks...

Terms of Service

Privacy Policy

Cookie Policy