5

Is it possible to reorder EKReminders in EKCalendar of type reminders? In native Reminders app it is possible, but I can't seem to find this option in the API.

Eli_Rozen
  • 1,301
  • 4
  • 20
  • 31
  • 1
    Do you want to change the order of what is in the Reminders app or are you just looking to have ordering within your own app? – Chris Wagner Aug 09 '13 at 19:08
  • I don't care, if it's not possible to do it in the API than just in my own app. What's the best way to do it in my own app? Maybe it's also a good way to save all reminders in Core Data for faster fetch. – Eli_Rozen Aug 09 '13 at 19:12

1 Answers1

4

So, EKCalendarItem objects have calendarItemExternalIdentifier which is unique to the event across devices. You can use this to your advantage for this ordering strategy.

Every time you fetch events from the calendar API, keep track of their calendarItemExternalIdentifier in whatever persistence store you choose (Core Data, SQLite, Property Lists, etc...) and also keep track of it's order.

So if you used Core Data you might have an entity with two attributes, calendarItemExternalIdentifier and order. Now whenever you present the events to the user, query the persistent store for order of each event and display accordingly. If new events come in, find the highest order and increment from there. When the user re-orders, set the order key for the appropriate record in your persistent store.

Chris Wagner
  • 20,773
  • 8
  • 74
  • 95
  • You are awesome, thank you for the great answer. Not related to the question, but, I want to have an option to "star" reminders. What I did until now was that each event that starts with "[*]" is starred. But if the user has 2k reminders in 20 different lists it would become slow to fetch all the starred reminders. Should I also add in the entity the attribute "isStarred", would it makes things faster? Thanks! – Eli_Rozen Aug 09 '13 at 19:29
  • I think any additional meta data for the events could be stored the same way. So yeah. – Chris Wagner Aug 09 '13 at 19:34