The Calendar
API in the Scripting app allows users to interact with iOS calendars. This API supports retrieving default calendars, creating custom calendars, and managing calendar settings and events.
Represents possible calendar types:
"birthday"
"calDAV"
"exchange"
"local"
"subscription"
Represents the type of calendar source object:
"birthdays"
"calDAV"
"exchange"
"local"
"mobileMe"
"subscribed"
Represents event availability settings:
"busy"
"free"
"tentative"
"unavailable"
Represents the type of calendar entity:
"event"
"reminder"
identifier: string
A unique identifier for the calendar.
title: string
The calendar’s title.
color: Color
The calendar’s color.
type: CalendarType
The calendar’s type.
allowedEntityTypes: CalendarEntityType
The entity types this calendar can contain ("event"
or "reminder"
).
isForEvents: boolean
Whether this calendar is for events.
isForReminders: boolean
Whether this calendar is for reminders.
allowsContentModifications: boolean
Whether you can add, edit, and delete items in the calendar.
isSubscribed: boolean
Whether the calendar is a subscribed calendar.
supportedEventAvailabilities: CalendarEventAvailability
The event availability settings supported by this calendar.
remove(): Promise<void>
Removes the calendar.
save(): Promise<void>
Saves changes to the calendar.
static defaultForEvents(): Promise<Calendar | null>
Retrieves the default calendar for events as specified by user settings.
static defaultForReminders(): Promise<Calendar | null>
Retrieves the default calendar for reminders as specified by user settings.
static forEvents(): Promise<Calendar[]>
Identifies calendars that support events.
static forReminders(): Promise<Calendar[]>
Identifies calendars that support reminders.
static create(options: { title: string, entityType: CalendarEntityType, sourceType: CalendarSourceType, color?: Color }): Promise<Calendar>
Creates a new calendar with the specified options.
title: string
: The calendar’s title.entityType: CalendarEntityType
: The entity type the calendar supports.sourceType: CalendarSourceType
: The account source type.color: Color
(optional): The calendar’s color.static presentChooser(allowMultipleSelection?: boolean): Promise<Calendar[]>
Presents a calendar chooser view.
allowMultipleSelection: boolean
(optional): Whether multiple selection is allowed. Defaults to false
.This document provides a comprehensive guide to using the Calendar
API. Leverage these APIs to manage calendars and events effectively.