Module stability and @testable for non-SPM binary frameworks

We use our own internal binary frameworks within our company. We have access to the Xcode projects and we build binaries with our CI system. Previously we needed to recompile all our frameworks for each new Xcode release, minor and major. When we updated to Swift 5.1 with module stability our frameworks could work with future versions of Xcode without recompilation.

However we found a limitation in module stability which we were unable to solve. If we import one of the frameworks with @testable, and this frameworks was built with different version of Xcode, our main project fails to compile a test target. This issue preventing us upgrading to Xcode 12 easily.

Module "FrameworkName" was not compiled for testing

Xcode 12 suggests to Remove '@testable' to fix this issue, however because it's just a test target we would like to avoid modifying main source target just for purpose of unit testing.

While our long term goal is to use SPM, we not fully adopted it yet. I was wondering is there any solution for this problem.

We compile our frameworks with following 2 settings for all targets (main and test):
  • BUILD_LIBRARY_FOR_DISTRBUTION set to YES

  • SKIP_INSTALL set to NO

Thanks for reading.

Replies

Nov 2020 Update

Forgot to mention important bits, we set ENABLE_TESTABILITY to YES, and we build DEBUG for testing.

The issue remains.