Unfortunately, right now this doesn't work. SwiftPM cannot distribute packages containing binary frameworks. With the right combination of directives SwiftPM can build the folder structure you have, but it is ineligible to be a SwiftPM dependency because it would require the use of unsafeFlags
for the linker, and you cannot use those in a package that is supposed to be a dependency.
What you can do, however, is distribute the binary frameworks separately and simply require that they be present and findable in order to build your SwiftPM package. To do that, you'd have to make some changes to the target Core
. This is what you have today:
.target(
name: "Core",
dependencies: [
"BinaryFramework",
"BinaryFramework2",
]
)
This is what you'd want:
.target(
name: "Core",
linkerSettings: [
.linkedFramework("BinaryFramework"),
.linkedFramework("BinaryFramework2"),
],
)
This instructs SwiftPM that you have dependencies on the binary frameworks and you expect them to be present. Note that they must be on the default linker path on the system that builds Core
, so you'll need to distribute and install them appropriately.