[Bug] Unit Test target ignores Xcode Package Dependencies

I am developing an iOS app which uses swift-gRPC services.

Following the official xcode documentation, I imported the swift-gRPC package from its github repository.

When creating tests for the gRPC code in view model, I realised the moment I write @testable import ViewModel in a blank XCTest file, and build the unit test target, I get an error Missing required module "CNIOAtomics".

I checked the missing module is from the swift-gRPC package. I also checked the Unit Tests are correctly pointing to the main app target.

It is very strange that this dependency problem does not happen in my main app target and all the code builds correctly.

Is this a bug? How do I fix it?

I found this issue under the both swift-gRPC and swift-nio projects on github. From the contributor disscusions, I can see the issue is likely caused by XCode since 2019. I will file a bug to https://feedbackassistant.apple.com as they suggested.

The issue may have just been fixed. Adding GRPC to the Link Binary with Libraries in test target works.

[Bug] Unit Test target ignores Xcode Package Dependencies
 
 
Q