I had an issue a while back with an XCFramework depending on a Swift Package, where the solution was to enable Library Evolution in the dependency.
The target looks like this:
.target( ... swiftSettings: [ // Emulate BUILD_LIBRARY_FOR_DISTRIBUTION to prevent culling of ABI used by // compiled frameworks. .unsafeFlags([ "-enable-library-evolution", "-emit-module-interface" ]), ]),
The following works when using the package as a dependency:
dependencies: [ .package(url: "...", branch: "main"), ],
The following fails:
dependencies: [ .package(url: "...", from: "0.0.2"), ],
dependencies: [ .package(url: "...", exact: "0.0.2"), ],
Both produce the following error:
xcodebuild: error: Could not resolve package dependencies:
the target 'PackageName' in product 'PackageName' contains unsafe build flags
Am I doing this right? Is there a different way to trigger full ABI generation in a package or one that doesn't use unsafe flags?
I'm pretty sure I can repackage the XCFramework without specifying a dependency, but that seems worse since errors won't be detected until the app runs and fails to resolve symbols.