Reorder EKReminder in a list

2019-05-16 11:58发布

问题:

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.

回答1:

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.



标签: ios eventkit