Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Resolving a service registered in a framework fails if Swinject is integrated via Swift Package Manager #425
I'm just playing around with the integration of Swinject using Swift Package Manager in Xcode 11 beta 4 and observing an issue I can't reproduce if Swinject is integrated with Carthage.
I have an App-Target as well as a Framework-target, both using Swinject. The framework registers its service
But when I try to resolve
I have various duplicate class warnings, too:
The Xcode project demonstrating the issue is available at chkpnt/SwinjectDemo.
Okay, the static lib is indeed causing this issue. Your workaround works, but only if there is not more than one framework involved. (I've added a second framwork to my demonstrator).
The only way I've found Xcode to build Swinject as a dynamic library is by modifying its
... products: [ .library(name: "Swinject", type: .dynamic, targets: ["Swinject"]) ], ...
This way, everything is working as expected. But in my opinion, this shouldn't be needed. In the documentation of SPM, the following is written:
-> There should be an option in Xcode to define how to consume the package.