What determines what list reminders are included in, such as the "Shopping List" list of reminders that has it's own view in the Reminders app. How do I access that list and how do I create a separate list programmatically. Is there a class object that translates to a list?
reminders list
Hi,
a list in the reminders app is a calendar. You can use the class EKCalendar to create and access those lists. In order to create a new "Shopping List" you can use the following code:
let calendar = EKCalendar(for: .reminder, eventStore: EKEventStore.sharedEventStore)
calendar.title = "Shopping list"
calendar.source = source
do {
try EKEventStore.sharedEventStore.saveCalendar(calendar, commit: true)
}
catch
{
print("Error info: \(error)")
}I use these class extension in the above code:
extension EKEventStore
{
@nonobjc static let sharedEventStore = EKEventStore()
func cloudSource() -> EKSource?
{
for source in self.sources
{
if source.sourceType == .calDAV && source.title == "iCloud"
{
return source
}
}
return nil
}
}This creates a new calendar called "Shopping list" in your iCloud account.
Entries in the list are objects of class EKReminder.
Dirk
That's great. That's just what I've been trying to figure out. Would you also know how to share that with reminders list with with other iCloud accounts, so that the user could share his list with users using different iCloud accounts than he is using?