For unit test files, there is also a file called "MyProjectTests-Bridging-Header.h" as well but I do not see a corresponding "MyProjectTests-Swift.h" file. Therefore, I am not able to access Objective-C classes within unit test files that are written in swift. Any suggestions?
Huh? There’s two directions to consider here:
Using Objective-C from Swift — To do this you include the relevant headers in your bridging header (
xxx-Bridging-Header.h) and Swift will pick things up from there.
Using Swift from Objective-C — To do this, you include the
xxx-Swift.hheader in your Objective-C code.
So, if you want to do the former you only need
It sounds like you’ve added the relevant includes to your app target bridging header (
MyProject-Bridging-Header.h) but not to your test target bridging header (
Share and Enjoy
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"