In order to use your main target's swift classes in XCTests, all you do is import your target module name into XCTests. At least, that's what the questions I came across suggested.
Now, because our project setup is complex, this doesn't seem to work. When importing the target module into XCTests, I get
Failed to import bridging header '/path/to/header/file.h'
Of course, I made sure the file exists. The only reason this fails for me, I think, is because we have a cyclic import between ObjC and swift. i.e Swift classes import ObjC classes, and those classes import swift classes, as well. To make that work, we tampered with the bridging header:
// See http://stackoverflow.com/questions/24098408/how-can-i-add-forward-class-references-used-in-the-swift-h-header
#ifndef Target_Bridging_Header_h
#import "Target-Swift.h"
#else
@class SomeSwiftClass;
@class OtherSwiftClass;
#endif
Anyone facing this issue? Anyway to resolve this?
UPDATE
I have verified my previous assumption regarding the cyclic imports. Thankfully, it was easy for me to break the cycle; now we don't have any #import "Target-Swift.h"
in any objective-c header. It is all neatly tucked away in the implementation files. The program compiles fine, for now.