I have two core data entities. Say Birthday & Anniversary.
Attributes of these entities are,
Birthday - Name, Age, Birth date
Anniversary - Name, Anniversary date
Showing each entity separately in a tableview can be done with fetched results controller. Thats fine!! But, I want to show a tableview that combines both birthdays and anniversary days. The sorting should be done by taking "Birth date" from Birthday & "Anniversary date" from Anniversary entity.
Questions:
Should I use two fetchedresultscontroller to fetch objects from these two entities? And then should I sort those objects? This is fine with minimal objects, but it takes more processing time when the count increases.
Should I create a common parent table, that posses "Birth date" and "Anniversary date" values? If so, how can I fetch & how can I define sort descriptor?
I'm really new to core data and dont have any idea about this scenario. Giving examples would be appreciated.
Thanks
You're best bet might be to use two fetchedresultscontrollers
, then sort each set of results within each other, then merge the two. That seems like a logical way to accomplish this...Another idea might be to have a common model between Birthday and Anniversary that shares as many properties as possible (IE name and date), and then you're sort descriptor could work on the model super class' date property.