-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Description
Hi,
I started using modified version of CoreValue on one of my projects and one problem with CoreValue became imminent.
let employee = Employee(objectID: nil, name: "John Doe", age: 18, position: "Clerk", department: "Carpet", job: "Cleaner", shop:nil)
var shop = Shop(objectID: nil, name: "Carpet shop", employees: [employee])
try! shop.save(context)
//Will crash in infinite loop
let shops:[Shop] = Shop.query(context, predicate: nil)
The Employee have inverse relationship with Shop. When I add employee to the Shop entity and save the corevalue will populate the inverse relationship. When I try to query the Shop program will crash in infinite loop.
This is of course logical, because we are working with structs, but it gets quite limiting. The solution is to not to unbox the inverse relationship but I found out that sometimes I need to use both sides of relationship.
I wonder if you are aware of the problem and if you have and idea how to solve it
Thanks
Metadata
Metadata
Assignees
Labels
No labels