How on earth can I create a .framework from a Swift package?

According to the responses on this post, Package.swift is no longer intended to be "convertible" to an Xcode project. This eliminates the ability to generate Xcode-specifc products such as .frameworks, since SPM doesn't support those proprietary formats out of the box.

The next thing tried is adding my package to a vanilla Xcode project and creating a Framework target and making the library from my package a dependency of it. But that doesn't seem to re-export the stuff in my package, as other Swift code can't see any of the types from the package when I import the framework.

I tried adding a single Swift file and @_exported import MyLibrary-ing it, but that gives me this error:

Underlying Objective-C module 'MyLibrary' not found

I'm at a loss. The only option now seems to be to build it by hand like a neanderthal. Does anyone know how to either resolve the above error, or how to do this all more gracefully?

1 Like

See How to build Swift Package as XCFramework - #53 by monocularvision