0
votes

I have an app target which includes a mix of Objective-C and Swift code. The Swift code uses Objective-C code and vice versa.

The app target is compiling fine, but when I try and compile my test target, it can’t find the “Objective-C Generated Interface Header”. Although the app target compiles fine, when it comes to compiling the app source code in the test target, the #import “MyApp-Swift.h” file results in a “file not found” error from the compiler.

If I check in the DerivedData folder, I can see the MyApp-Swift.h file inside the DerivedSources folder for the app MyApp.build folder, but not for Tests.build (which has no DerivedSources folder).

Does anyone know how to resolve this issue please?

1
Did you try @testable import MyApp in your test file?NSDmitry
Yes, this was already included in the test file. Although the test source code was compiling fine, it was the app code that wasn't compiling under the test target.Andrew Ebling

1 Answers

0
votes

Ensure that the app source files are only included in the app target and not in the test target as well.

Although it used to be necessary to include the app source in both the app and test targets, this is no longer the case.