Xcode - File is part of module, ignoring import

折月煮酒 提交于 2021-01-28 07:02:21

问题


I have existing iOS project, added Unit test target and created new test case file in tests folder. When i tried to import module i'm facing this issue. I referred the below stack overflow question but it did not solve my problem.

Xcode - Test class File is part of module, ignoring import

@testable import wl_pih // Error: File 'wl_pihTests.swifts' is part of module 'wl_pih'; ignoring import

class wl_pihTests: XCTestCase {

    let loginController = INCLoginViewController() //Not accessable
     override func setUp() {
        super.setUp()
    }

    override func tearDown() {
              super.tearDown()
    }
}


回答1:


The error is telling you that because your test file is in your wl_pih target, there's no need for the @testable import wl_pih statement. @testable import is used in test files that are in a unit test or UI test target to give them access to files in the target that you want to test. The easiest fix is to delete your import. What you really should do, though, is to put your test files in your unit testing target (so that they don't get bundled into your deliverable app), and leave the @testable import statement in each test file.



来源:https://stackoverflow.com/questions/45870329/xcode-file-is-part-of-module-ignoring-import

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