Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMike Zhu
1,840 PointsWhat is the inverse relationship in Core Data?
I am new to Core Data in iOS. I would like to know the difference between "inverse" relationship and "No inverse" relationship between difference entities.
1 Answer
Greg Kaleka
39,021 PointsHi Mike,
This is a concept that doesn't only apply to CoreData, but rather extends to databases in general. Essentially, the difference is that "inverse" relationships are ones that go in both directions. For example a teacher has many students, and each student has that teacher.
A unidirectional relationship (or "no inverse" as you put it) is one that goes only one way. It's harder to come up with an easy to grasp example, and it's generally not a good idea to model your data this way, since you will end up with a lot of potential issues you'll need to keep track of.
Check out more details in the docs I linked to above.
Cheers,
-Greg