Swift Unit Testing in Xcode is not finding any Objective-C types

Viewed 54

I'm trying to write some unit tests in Swift in Xcode. I'm needing to make use of two Swift files because they have the classes I need to utilize in this unit test.

These two Swift files build and run properly when I normally build/run my project.

However, when I attempt to use them in my unit test, I get errors for any types that are referenced in these two Swift files that are coming from any Objective-C file.

See this image:

missing types

These missing types are coming from an Objective-C file. Now, these Objective-C files ARE included in my bridging header file so that's not the problem.

I have no other info to work off.

1 Answers

I figured it out. I was missing @testable in the import statement. After adding @testable, it works.

Related