Skip to content

Commit b5e004c

Browse files
committed
Use an array for the toMany relationship
Yes, it is wrong, but more consistent with what SwiftData does :-)
1 parent bbe9d62 commit b5e004c

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

ManagedToDos/Models/ToDoList.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@ import ManagedModels
1414
@Model
1515
final class ToDoList: NSManagedObject {
1616

17-
var title : String
18-
var toDos : Set<ToDo> // currently can't use `[ ToDo ]` here.
19-
17+
var title = ""
18+
var toDos = [ ToDo ]()
19+
2020
convenience init(title: String) {
2121
self.init()
2222
self.title = title
23-
self.toDos = []
2423
}
2524

2625
var hasOverdueItems : Bool { toDos.contains { $0.isOverDue && !$0.isDone } }

0 commit comments

Comments
 (0)