Post

Replies

Boosts

Views

Activity

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: 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
1
1
1.2k
Jul ’20
Modelling dependencies
I'm stuck at an error EXC_BREAKPOINT (code=1, subcode=0x1a8d69a38)that is thrown in a class during initialization. The class is defined as: @Model public final class Parent { @Attribute(.unique) public var uuid: UUID /// The date specification. @Relationship(.cascade) public var dateSpec: DateSpec /// The title. public var title: Title /// The subtitle. public var subTitle: Subtitle public init(uuid: UUID, dateSpec: DateSpec, title: Title, subTitle: Subtitle) { self.uuid = uuid self.dateSpec = dateSpec self.title = title self.subTitle = subTitle } } The error is thrown in the var dateSpec property at the return self.getValue(for: \.dateSpec) call of the @PersistedProperty macro. DateSpec is defined this way: @Model public final class DateSpec { @Attribute(.unique) public var uuid: UUID /// The type of the date specification (`.point` or `.range`). public var type: DateSpecType @Relationship(.cascade) public var point: DatePoint @Relationship(.cascade) public var range: DateRange public init(uuid: UUID, type: DateSpecType = .none, point: DatePoint = .init(), range: DateRange = .init()) { self.uuid = uuid self.type = type self.point = point self.range = range } } And DatePoint is defined so: @Model public final class DatePoint { @Attribute(.unique) public var uuid: UUID public var format: String public var date: Date? public init(uuid: UUID, format: String, date: Date? = nil) { self.uuid = uuid self.format = format self.date = date } } (DateRange accordingly). So, as far as I understood the sessions, this should work. Or did I miss something? -- Edit: When taking out DatePoint and DateRange from the model, and replacing the properties by .transient wrappers that get/set the respective properties directly in DateSpec, then the error disappears. So, is the problem the cascading of the relationships between Parent and DateSpec, and DateSpec and DatePoint/DateRange?
2
0
907
Jun ’23