Calendar
Holds reminders and events.
Use the Calendar type to get a specific calendar. The calendar is used with the Reminder and CalendarEvent types when fetching reminders or events from a specific calendar or when inserting into a calendar. If you are fetching reminders or events from all calendars, you do not need to pass the calendars when performing the fetch with the Reminder or CalendarEvent types.
Properties
Section titled “Properties”allowsContentModifications
Section titled “allowsContentModifications”Indicates whether items can be added, edited, and deleted in the calendar.
allowsContentModifications: boolRead-only.
Color of calendar.
color: Coloridentifier
Section titled “identifier”Calendar identifier.
identifier: stringRead-only.
isSubscribed
Section titled “isSubscribed”Whether the calendar is a subscribed calendar.
isSubscribed: boolRead-only.
Title of calendar.
title: stringMethods
Section titled “Methods”
createForReminders(title)
Section titled “createForReminders(title)”Create a new calendar that holds reminders.
static createForReminders(title: string): Promise<Calendar>This will create a new list for reminders in the Reminders app. The list is automatically saved so there is no need to call save() after creating the list.
Parameters
Section titled “Parameters”title string
Return value
Section titled “Return value”Promise<Calendar>
Promise that provides the created calendar when fulfilled.
defaultForEvents()
Section titled “defaultForEvents()”Default calendar for events.
static defaultForEvents(): Promise<Calendar>A calendar can only hold either reminders or events. Call this function to get the default calendar that can hold events.
Return value
Section titled “Return value”Promise<Calendar>
Promise that provides the calendar when fulfilled.
defaultForReminders()
Section titled “defaultForReminders()”Default calendar for reminders.
static defaultForReminders(): Promise<Calendar>A calendar can only hold either reminders or events. Call this function to get the default calendar that can hold reminders.
Return value
Section titled “Return value”Promise<Calendar>
Promise that provides the calendar when fulfilled.
findOrCreateForReminders(title)
Section titled “findOrCreateForReminders(title)”Find or create a new calendar that holds reminders.
static findOrCreateForReminders(title: string): Promise<Calendar>This will attempt to find a calendar for reminders with the specified name. If no calendar is found, a new calendar is created and the calendar will appear as a reminder list in the Reminders app. If multiple calendars are found for the specified name, the first one will be returned. The list is automatically saved so there is no need to call save() in the case the list was created.
Parameters
Section titled “Parameters”title string
Return value
Section titled “Return value”Promise<Calendar>
Promise that provides the calendar when fulfilled.
forEvents()
Section titled “forEvents()”Fetches calendars for events.
static forEvents(): Promise<[Calendar]>A calendar can only hold either reminders or events. Call this function to fetch all calendars that can hold events.
Return value
Section titled “Return value”Promise<[Calendar]>
Promise that provides the calendars when fulfilled.
forEventsByTitle(title)
Section titled “forEventsByTitle(title)”Fetches a calendar that holds events.
static forEventsByTitle(title: string): Promise<Calendar>Parameters
Section titled “Parameters”title string
Title of calendar.
Return value
Section titled “Return value”Promise<Calendar>
Promise that provides the calendar when fulfilled.
forReminders()
Section titled “forReminders()”Fetches calendars for reminders.
static forReminders(): Promise<[Calendar]>A calendar can only hold either reminders or events. Call this function to fetch all calendars that can hold reminders.
Return value
Section titled “Return value”Promise<[Calendar]>
Promise that provides the calendars when fulfilled.
forRemindersByTitle(title)
Section titled “forRemindersByTitle(title)”Fetches a calendar that holds reminders.
static forRemindersByTitle(title: string): Promise<Calendar>Parameters
Section titled “Parameters”title string
Title of calendar.
Return value
Section titled “Return value”Promise<Calendar>
Promise that provides the calendar when fulfilled.
presentPicker(allowMultiple)
Section titled “presentPicker(allowMultiple)”Presents a view for picking calendars.
static presentPicker(allowMultiple: bool): Promise<[Calendar]>Parameters
Section titled “Parameters”allowMultiple bool
Whether to allow picking multiple calenders. Defaults to false.
Return value
Section titled “Return value”Promise<[Calendar]>
Promise that provides the calendars when fulfilled.
remove()
Section titled “remove()”Removes calendar.
remove()The calendar is removed immediately. This cannot be undone.
save()
Section titled “save()”Saves calendar.
save()Saves changes to the calendar.
supportsAvailability(availability)
Section titled “supportsAvailability(availability)”Checks if the calendar supports availability.
supportsAvailability(availability: string): boolThe following values are supported:
- busy
- free
- tentative
- unavailable
Not all calendars support all of these availabilities and some calendars may not support availability at all. Use this function to check if the calendar supports a specific availability.
Parameters
Section titled “Parameters”availability string
Availability to check against.
Return value
Section titled “Return value”bool
True if the calendar supports the availability, otherwise false.