Why SwiftPM static library produces dynamic framework?

Hello everyone,

I am currently migrating my large project's binary dependencies from dynamic to static binaries. To achieve this, I am creating an SPM (Swift Package Manager) package with all of my third-party dependencies. Here is an example of an RxSwift dependency declaration:


let package = Package(
    name: "ThirdPartyDeps",
    products: [
        .library(name: "RxSwift", targets: ["RxSwift"])
    ],
    targets: [
        .binaryTarget(
            name: "RxSwift",
            url: "some_link_to_static_library.zip",
            checksum: "..."
        )
    ]
)

This declaration produces the expected static linking to my main app binary. However, I still see the RxSwift.framework in the MyApp.app/Frameworks folder, which contains a small dynamic "Mach-O 64-bit dynamically linked shared library" of size 35kb and a _CodeSignature folder. I encounter this small, seemingly useless framework for every dependency I migrate from dynamic to static linking.

Does anyone know the reason for its presence and how I can instruct Xcode not to produce it?

Thank you

1 Like