Calendar
Access and manage iOS calendars and reminder lists
Calendar provides access to the user's calendars for both events and reminders. Requires calendar access permissions.
Use Calendar to:
Examples
let calendars = await Calendar.forEvents();
for (let cal of calendars) {
console.log(cal.title);
}let cal = await Calendar.createForReminders("Shopping");
console.log(cal.identifier);let cal = await Calendar.findOrCreateForReminders("Work Tasks");
cal.color = Color.blue();
await cal.save();Properties
identifier
- Type:
String
Unique identifier for this calendar
calendar.identifiertitle
- Type:
String
Display title of the calendar
calendar.titleisSubscribed
- Type:
Bool
Whether this is a subscribed (read-only) calendar
calendar.isSubscribedallowsContentModifications
- Type:
Bool
Whether modifications are allowed
calendar.allowsContentModificationsMethods
getColor
Get calendar color
getColor(): ColorReturns: Color object representing the calendar color
Example:
let color = calendar.colorsetColorWithBridge
Set calendar color
setColorWithBridge(color): voidcolor- Color to set
Example:
calendar.color = Color.red()supportsAvailability
Check if calendar supports an availability type
supportsAvailability(availability): booleanavailability- "busy", "free", "tentative", or "unavailable"
Returns: true if the availability type is supported
Example:
calendar.supportsAvailability("busy")save
Save changes to this calendar
save(): voidReturns: Promise that resolves when saved
Example:
await calendar.save()remove
Delete this calendar
remove(): voidReturns: Promise that resolves when removed
Example:
await calendar.remove()forReminders
Get all reminder calendars (lists)
static forReminders(): voidReturns: Promise resolving to array of Calendar objects
Example:
let calendars = await Calendar.forReminders()forEvents
Get all event calendars
static forEvents(): voidReturns: Promise resolving to array of Calendar objects
Example:
let calendars = await Calendar.forEvents()forRemindersByTitle
Find a reminder calendar by title
static forRemindersByTitle(title): voidtitle- Calendar title to search for
Returns: Promise resolving to Calendar or error if not found
Example:
let cal = await Calendar.forRemindersByTitle("Shopping")forEventsByTitle
Find an event calendar by title
static forEventsByTitle(title): voidtitle- Calendar title to search for
Returns: Promise resolving to Calendar or error if not found
Example:
let cal = await Calendar.forEventsByTitle("Work")createForReminders
Create a new reminder calendar
static createForReminders(title): voidtitle- Title for the new calendar
Returns: Promise resolving to the new Calendar
Example:
let cal = await Calendar.createForReminders("My List")findOrCreateForReminders
Find or create a reminder calendar
Returns existing calendar if found, otherwise creates a new one.
static findOrCreateForReminders(title): voidtitle- Calendar title
Returns: Promise resolving to Calendar
Example:
let cal = await Calendar.findOrCreateForReminders("Tasks")defaultForReminders
Get the default reminder calendar
static defaultForReminders(): voidReturns: Promise resolving to the default Calendar
Example:
let cal = await Calendar.defaultForReminders()defaultForEvents
Get the default event calendar
static defaultForEvents(): voidReturns: Promise resolving to the default Calendar
Example:
let cal = await Calendar.defaultForEvents()presentPicker
Present a calendar picker UI
Shows a system calendar chooser dialog. Not available in widgets.
static presentPicker(allowMultiple): voidallowMultiple- Allow selecting multiple calendars
Returns: Promise resolving to array of selected Calendars
Example:
let selected = await Calendar.presentPicker(true)