I'm using Swift Package Manager on an iOS app on Xcode 11 following the instructions from https://developer.apple.com/videos/play/wwdc2019/408/
Everything looks great, except Unit Tests won't work now.
This occurs because at the moment (Xcode 11.1, October 2019) SPM decencies are not automatically linked to test targets.
We can manually link it by:
Headlines
)HeadlinesTests
)Build Phases
in the top bar.Link Binary With Libraries
phase, add the required library from the SPM dependency (this looks like a white building within the SPM package 📦).Dependencies
phase.After researching a bit, I got this fixed by adding -Xcc -fmodule-map-file=$(PROJECT_TEMP_ROOT)/GeneratedModuleMaps/macosx/<missing module name>.modulemap
to OTHER_SWIFT_FLAGS
in the test target.
Source:
PS: Use -Xcc -fmodule-map-file=$(PROJECT_TEMP_ROOT)/GeneratedModuleMaps/iphonesimulator/<module name>.modulemap
if your platform is iOS.
UPDATE: Also, it seems that this is fixed on Xcode 11.2 beta2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With