File tree Expand file tree Collapse file tree 4 files changed +9
-9
lines changed
Expand file tree Collapse file tree 4 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -186,7 +186,7 @@ extension NoteEditingViewController: UIPickerViewDelegate {
186186
187187 func selectedPickerRow( for note: Note ) -> Int {
188188 guard let authorId = note. author. targetId else { return 0 }
189- guard let authorIndex = authors. firstIndex ( where: { $0. id == authorId } ) else { return 0 }
189+ guard let authorIndex = authors. firstIndex ( where: { $0. id == authorId. value } ) else { return 0 }
190190 return authorIndex + 1
191191 }
192192 }
Original file line number Diff line number Diff line change @@ -16,15 +16,15 @@ class NotesOverviewViewController: UITableViewController {
1616 struct Filter {
1717 static var all : Filter { return Filter ( authorId: nil ) }
1818
19- let authorId : EntityId < Author > ?
19+ let authorId : Id ?
2020 let query : Query < Note >
2121 var queryObserver : Observer ?
2222
23- init ( authorId: EntityId < Author > ? , noteBox: Box < Note > = Services . instance. noteBox) {
24- self . authorId = authorId
23+ init ( authorId: Id ? , noteBox: Box < Note > = Services . instance. noteBox) {
24+ self . authorId = authorId? . value
2525
2626 if let authorId = authorId {
27- query = try ! noteBox. query { Note . author == authorId } . build ( )
27+ query = try ! noteBox. query { Note . author. isEqual ( to : authorId) } . build ( )
2828 } else {
2929 query = try ! noteBox. query ( ) . build ( )
3030 }
@@ -35,7 +35,7 @@ class NotesOverviewViewController: UITableViewController {
3535 }
3636 }
3737
38- func filterBy( authorId: EntityId < Author > ? ) {
38+ func filterBy( authorId: Id ? ) {
3939 filter = Filter ( authorId: authorId)
4040 }
4141
@@ -100,7 +100,7 @@ extension NotesOverviewViewController {
100100 controller. mode = . draft
101101 controller. note = {
102102 let draft = Note ( )
103- draft. author. targetId = filter. authorId
103+ draft. author. targetId = filter. authorId != nil ? EntityId < Author > ( filter . authorId! ) : nil
104104 draft. modificationDate = Date ( )
105105 return draft
106106 } ( )
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import ObjectBox
44
55// objectbox:Entity
66class Author {
7- var id : EntityId < Author > // An `EntityId<Author>` is required by ObjectBox
7+ var id : Id // An ID is required by ObjectBox
88 var name : String
99 // objectbox: backlink = "author"
1010 var notes : ToMany < Note >
Original file line number Diff line number Diff line change 33import ObjectBox
44
55class Note : Entity {
6- var id : EntityId < Note > = 0 // An `EntityIdNote>` is required by ObjectBox
6+ var id : Id = 0 // An ID is required by ObjectBox
77 var title : String = " " {
88 didSet {
99 modificationDate = Date ( )
You can’t perform that action at this time.
0 commit comments