unit test module import throws undefined symbol error

Viewed 522

I am trying to import my class using this code

import XCTest
@testable import Test2

class Tests_iOS: XCTestCase {
    var test2:TestModule2!
    
    override func setUp() {
        let test2 = TestModule2()
    }
}

however xcode is throwing undefined symbol error

Undefined symbol: nominal type descriptor for Test2.TestModule2
Undefined symbol: type metadata accessor for Test2.TestModule2
Undefined symbol: Test2.TestModule2.__allocating_init() -> Test2.TestModule2

This doesn't happen with my older xcode 11 code using UIKit.

enter image description here

what is the cause of this error and how can I import modules correctly.

system specification

Mac M1 16GB
OS: Big Sur 11.4
Xcode: Version 13.0 beta (13A5154h)
1 Answers
Related