Core Data: inverse relationship for two relationships with same type

前端 未结 2 694
死守一世寂寞
死守一世寂寞 2020-12-18 19:33

In my app Core Data model I have Sheet and Text entities. Sheet entity can have two Text\'s: privacyNotes and termsOfUse.

Both of Text type. So in XCode data modeler

2条回答
  •  一生所求
    2020-12-18 20:08

    You are far better off having a one to many relationship between Sheet and Text with a validation limit of 2. Then you should have a type property in the text which declares it as either a privacyNotes or termsOfUse. From there you can add convenience methods to your Sheet subclass that allows you to retrieve either one.

提交回复
热议问题