Open npvisual opened 3 years ago
Note : the same issue is seen with Bond. Same fix is suggested.
Another approach would be to declare different libraries, each with the library type defined as illustrated in the SPM Package Description API documentation :
...
let package = Package(
name: "Paper",
products: [
.executable(name: "tool", targets: ["tool"]),
.library(name: "Paper", targets: ["Paper"]),
.library(name: "PaperStatic", type: .static, targets: ["Paper"]),
.library(name: "PaperDynamic", type: .dynamic, targets: ["Paper"]),
],
dependencies: [
...
until Xcode is able to figure things out by itself (maybe there's a flag for that ™️?). This however might not be desirable...
Thanks for working on this @npvisual. I think we should go with the additional product approach. It's more flexible option.
Hopefully in future one will be able to specify that at the point of use.
Description
When using SPM to load RK in Xcode 12 Beta 4, for a project with multiple modules that leverage RK, I run into the following issue :
If I somehow manage to circumvent that message by linking "binaries with library" and only embedding the frameworks at the product level, the application will compile, but will result in crashes at runtime with warning messages when the application starts similar to :
Solution
I unfortunately haven't found many resources on this particular issue with SPM. However this git repo seems to highlight the same issue and mentions the following :
So I gave it a shot, forked RK and forced it be loaded dynamically by using
.dynamic
inPackage.swift
. And it worked great. No more compilation issues and no runtime crash.