Cannot build tests for SwiftUI App

I created a SwiftUI Catalyst App, using the default tests. In the pure default version, they are building. The app itself is building without any problems.

However, when adding @testable import XYZ, the iOS test build fails with this message:

Code Block
Undefined symbols for architecture x86_64:
  "protocol conformance descriptor for XYZ.BrickType : Swift.Equatable in XYZ", referenced from:
      lazy protocol witness table accessor for type XYZ.BrickType and conformance XYZ.BrickType : Swift.Equatable in XYZ in Tests_StructureItem.o
  "direct field offset for XYZ.StructureItem.brick : XYZ.Brick", referenced from:
      implicit closure #1 () throws -> XYZ.BrickType in Tests_iOS.Tests_StructureItem.test_createStructure() -> () in Tests_StructureItem.o
  "type metadata accessor for XYZ.BrickBuilder", referenced from:
      Tests_iOS.Tests_StructureItem.test_createStructure() -> () in Tests_StructureItem.o
  "type metadata for XYZ.BrickType", referenced from:
      Tests_iOS.Tests_StructureItem.test_createStructure() -> () in Tests_StructureItem.o
      lazy protocol witness table accessor for type XYZ.BrickType and conformance XYZ.BrickType : Swift.Equatable in XYZ in Tests_StructureItem.o
  "static XYZ.BrickBuilder.build() -> [XYZ.Brick]", referenced from:
      Tests_iOS.Tests_StructureItem.test_createStructure() -> () in Tests_StructureItem.o
  "direct field offset for XYZ.Brick.type : XYZ.BrickType", referenced from:
      implicit closure #1 () throws -> XYZ.BrickType in Tests_iOS.Tests_StructureItem.test_createStructure() -> () in Tests_StructureItem.o
  "type metadata accessor for XYZ.StructureModel", referenced from:
      Tests_iOS.Tests_StructureItem.test_createStructure() -> () in Tests_StructureItem.o
  "XYZ.StructureModel.allocating_init() -> XYZ.StructureModel", referenced from:
      Tests_iOS.Tests_StructureItem.test_createStructure() -> () in Tests_StructureItem.o
  "type metadata accessor for XYZ.Brick", referenced from:
      Tests_iOS.Tests_StructureItem.test_createStructure() -> () in Tests_StructureItem.o
  "type metadata accessor for XYZ.StructureItem", referenced from:
      Tests_iOS.Tests_StructureItem.test_createStructure() -> () in Tests_StructureItem.o
  "XYZ.StructureItem.allocating_init(brick: XYZ.Brick, children: [XYZ.StructureItem]?) -> XYZ.StructureItem", referenced from:
      Tests_iOS.Tests_StructureItem.test_createStructure() -> () in Tests_StructureItem.o
  "default argument 1 of XYZ.StructureItem.init(brick: XYZ.Brick, children: [XYZ.StructureItem]?) -> XYZ.StructureItem", referenced from:
      Tests_iOS.Tests_StructureItem.test_createStructure() -> () in Tests_StructureItem.o
  "XYZ.StructureModel.insert(structureItem: XYZ.StructureItem, at: Swift.Int) -> ()", referenced from:
      Tests_iOS.Tests_StructureItem.test_createStructure() -> () in Tests_StructureItem.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)


What seems strange to me is the obvious clash between iOS and architecture x86_64. I already checked the build settings, but did not detect anything unusual. The versions are all set to "macOS 10.16" or "iOS 14.0" (depending on target "iOS/Tests iOS" or "macOS/Tests macOS").

Any ideas why this happens, and how to fix it?

Environment:
  • Catalina

  • Xcode 12 beta

I'm getting the exact same issue, did you ever find the solution?

I don't know if it's relevant but I'm using the new project template with the shared App struct between macOS and iOS
Cannot build tests for SwiftUI App
 
 
Q