问题
I have Test target for my framework project which include:
- Obj-C tests
- Swift tests with @testable import to test internal classes and functions
- Some utils written in Obj-C for my tests which should be used in both 1) and 2)
Since I want to use Obj-C utils I should add Bridging header to my test target to have access from swift sources. The problem is that @testable import doesn't work with Bridging header simultaneously: as long as I don't use Bridging header I have access to all internal API from my swift test sources, but when I add Bridging header I have only access to public API.
Has anyone experienced that? Is @testable directive implemented using Bridging header which makes using both simultaneously impossible? Thoughts on how to resolve the issue?
UPDATE: Apparently problem appears when you're importing the same framework as @testalbe in your swift code and using @import in Obj-C in your bridging header (directly or in one of included headers). I can manage my code to avoid importing framework simultaneously from Bridging header and swift, though general problem is not resolved
来源:https://stackoverflow.com/questions/45939804/testable-import-and-bridging-header-dont-work-simultaneously