Use of undeclared type 'ViewController' when unit testing my own ViewController in Swift?

前端 未结 3 1661
谎友^
谎友^ 2020-12-29 21:06

I have been trying to write test cases in Swift to test my ViewController. However, when I try to instantiate my own ViewController in a XCTestCase I get \"Use of undecla

3条回答
  •  余生分开走
    2020-12-29 21:51

    I also got this error recently and none of the above steps fixed the problem, what did fix it was removing non-swift file from the Compile sources build phase in the Target you want to run tests on.

    Make sure your app is actually compiling. This was failing silently and the error message wasn't helpful

提交回复
热议问题