I'm writing an app in Swift, using XCode 6 Beta-6. I'm using Cocoapods and I'm creating some unit tests.
The issue is this one: apparently is not possible to have a project that contains:
1) Project written in Swift
2) Some pods installed using cocoapods
3) A Objective-C bridge header file that imports some pods
4) Unit tests
This sounds weird, but follow my steps: after running pod install
, create the Objective-C bridge header and import one pod: everything works.
Now write some tests: in order to test your own classes, you have to import the module called "as your project" (or better, "as the main target"): in my "MyAwesomeApp" project I have to write import MyAwesomeApp
in my tests files.
Unfortunately, at this step XCode won't compile:
in my import MyAwesomeApp
line with the error "Failed to import bridging header '/path/to/MyAwesomeApp/MyAwesomeApp/MyAwesomeApp-Bridging-Header.h";
and the error "xxx.h file not found" appears in the Bridging-Header file, excluding the possibility to import a pod.
Also, if I don't import the pods in the Obj-c bridge file, the project will compile fine.
It looks that there is a conflict importing both the Objective-C Bridge Header (with Objective-C files taken from a different sub-project in the workspace) and the "main module" used for testing.
Do you know if there is a solution? What am I missing? Thanks
NOTE: As a workaround, I could import the pods in the Objective-C Bridge Header, and, instead of include the main module in my tests, add all the classes that I want to test in my "test" target. This will work, but it's not the most clean solution (I think)