I have a new SwiftUI project I'm working with on my M1Pro. The project is a simple single screen app and I selected new project app when I created it. Selecting to create unit test targets as well.
The app builds and runs. The UI tests build and run successfully.
I then attempted to create a simple unit test and run it. However it's not compiling. The apps module name is "PointsMasterII" and when try to add import PointsMasterII
to the unit test, I get the error:
Could not find module 'PointsMasterII' for target 'x86_64-apple-ios-simulator'; found: arm64, arm64-apple-ios-simulator, at: /Users/derekclarkson/Library/Developer/Xcode/DerivedData/PointsMasterII-ahjymfmhybwxvxakiwljcqfzmqea/Index/Build/Products/Debug-iphonesimulator/PointsMasterII.swiftmodule
I also had this is the test class:
func testPoints() {
let calc = Calculator()
}
And when I checked the log of the build I saw
Undefined symbols for architecture arm64:
"type metadata accessor for PointsMasterII.Calculator", referenced from:
Tests_iOS.CalculatorTests.testPoints() -> () in CalculatorTests.o
"PointsMasterII.Calculator.__allocating_init() -> PointsMasterII.Calculator", referenced from:
Tests_iOS.CalculatorTests.testPoints() -> () in CalculatorTests.o
ld: symbol(s) not found for architecture arm64
I don't know how to fix this. I would have expected it to work as the unit test target has the PointsMasterII app as a dependency (setup by Xcode) and the app and UI tests run fine.
Any pointers as to what to look at?