"Link Binary with Libraries" for unit test target needs Apollo and ApolloSQLite

I have a few libraries in my iOS app target where I’m using Apollo via SPM. I’ve now created a unit test target for my application and Xcode requires that I add Apollo and ApolloSQLite to my “Link Binary with Libraries” phase for unit test target. Why is this needed?

You shouldn’t need to link to any of the libraries unless you’re using code within them. What is the message from Xcode that makes you think it’s required?

This the error, it goes away after I import ApolloSQLite. In my tests, I have @testable import project_name, is it because of this? None of my tests use any Apollo code directly.

Do you use ApolloSQLite in your main project? If not then make sure you’re not linking the library with your main project. If it’s not used anywhere it really shouldn’t be needed.

We do use it in our main project, so it’s needed there.