I want to make an Entity for Location with properties: latitude & longitude. Then, I want to set a relationship from User to Location, from Photo to Location, etc. Should I do it without creating an inverse relationship from Location to the others? Otherwise, how would I do it like that?
Thanks!
Matt
In most cases, you want to create an inverse relationship.
Inverse relationships make maintaing graph integrity easier and, more importantly, inverse relationships reflect the real-world relationships between the objects, events or conditions that the model simulates. The point of an object graph isn't merely the dumb storage of bits of data but also the active modeling of the relationships between different parts of that data. In Core Data, relationships themselves are active data.
In the real-world, photos are taken in locations and inversely some locations have photos taken in them. An inverse relationship would model that reality and give you the option of searching for photos based on their locations.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With