@testable import and Bridging header don't work simultaneously

南笙酒味 提交于 2019-12-10 15:31:50

问题


I have Test target for my framework project which include:

  1. Obj-C tests
  2. Swift tests with @testable import to test internal classes and functions
  3. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!