Case:
I am working on an app using Core Data with 2 different entities Note and Sleep. During a day there may be added instances of these entities multiple times.
Note stores timestamp (Date), a note (String) and a few other irrelevant attributes. Used to take daily notes.
Sleep stores timeStart (Date) and timeEnd (Date) - Used to track the user's sleep.
Issue
I want to fetch all the entries of both Entities Note + Sleep and group them by timestampand timeEnd; so it can be displayed in a table view with a cell/row for each date.
The sleep data will be used to calculate the total hours of sleep (e.g. if the user sleeps twice a day)
Some days there might be only Notes and other days only Sleep.
How would I go about this? I hope it makes sense; otherwise please let me know.