Reputation: 36427
I've read here but told to open a new question.
I have CountryEntity
. It has two relations.
capital
with a CityEntity
destination—type one to onecities
with a CityEntity
destination— type one to many. How I should set the inverse part. Apparently only either capital or cities can have a relation with the CountryEntity
.
Current issue:
Upvotes: 1
Views: 215
Reputation: 70976
You just... create the relationships, and give each one an inverse relationship. No special steps are needed. From your description,
capital
would have a to-one inverse called something like capitalOf
, to indicate which CountyEntity
the CityEntity
is capital of. If a city is not the capital, the value of the relationship would be nil.cities
would have a to-one inverse called something like county
to indicate that the CityEntity
is in the CountyEntity
. This would never have a nil value.Apparently only either capital or cities can have a relation with the
CountryEntity
This isn't true, or at least it's not required by Core Data.
Upvotes: 1