In Xcode 15 beta 6, the swift compiler crashes with a simple SwiftData model. The model compiles OK, but any attempt to instantiate the entity in code, including a unit test, will crash the compiler. A stack track is provided with a note to submit a bug report. Some SwiftData classes work without error, but this example will crash. Cannot find any workaround and am forced to remain on beta 5 for now. Anyone else experiencing this? Works without error in beta 5.
Compiler crashes in a basic unit test on this line, or any other attempt to instantiate the model.
let note = Note(content: "Went for a bike ride this morning!")
public final class Note: Identifiable {
@Attribute(.unique) public private(set) var id: UUID?
public private(set) var createdDate: Date
public private(set) var updatedDate: Date
/// Optional title for this note
public var title: String? {
didSet { updatedDate = Date() }
}
/// Note content
public var content: String? {
didSet { updatedDate = Date() }
}
public init(title: String? = nil, content: String) {
self.id = UUID()
self.createdDate = Date()
self.updatedDate = Date()
self.title = title
self.content = content
}
}