Naresh
Naresh

Reputation: 91

Xcode - File is part of module, ignoring import

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()
    }
}

Upvotes: 1

Views: 1889

Answers (1)

NRitH
NRitH

Reputation: 13903

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.

Upvotes: 1

Related Questions