now in swift 4 you just have to import a briding header into Test target and reference objc-class .h files there...using @testable import nameOfYourApp should work
In Swift there's a message in "Test Target" that states that the bridging header will be removed in newer versions of swift. I'm using mixed objc and swift clasess, but the UnitTest class is a swift file. Using @testable key was there in code
@testable import YourProject
You fix it by adding in your Test area the bridging header with objc headers that your test will use:
#import "Project-Bridging-Header.h"
and deleting the @testable inside your test
import YourProject
Removing
@testable
in my test class leads to a lot of unresolved types, which are no longer imported from the "main" target.For me the solution was much simpler, just go to the
AppTest-Bridging-Header.h
and add#import "App-Bridging-Header.h"
. I didn't touch the test class and kept the@testable
.