---
title: "saveCalendar(_:commit:)"
framework: eventkit
role: symbol
role_heading: Instance Method
path: "eventkit/ekeventstore/savecalendar(_:commit:)"
---

# saveCalendar(_:commit:)

Saves a calendar to the event store by either committing or batching the changes.

## Declaration

```swift
func saveCalendar(_ calendar: EKCalendar, commit: Bool) throws
```

## Parameters

- `calendar`: The calendar to save.
- `commit`: doc://com.apple.documentation/documentation/Swift/true to save the calendar immediately; otherwise, the change is batched until the doc://com.apple.eventkit/documentation/EventKit/EKEventStore/commit() method is invoked.

## Discussion

Discussion This method raises an exception if calendar belongs to another event store. note: In Swift, this method returns Void and is marked with the throws keyword to indicate that it throws an error in cases of failure. Call this method in a try expression and handle any errors in the catch clauses of a do statement, as described in Error Handling in The Swift Programming Language and About Imported Cocoa Error Parameters.

## See Also

### Accessing calendars

- [defaultCalendarForNewEvents](eventkit/ekeventstore/defaultcalendarfornewevents.md)
- [defaultCalendarForNewReminders()](eventkit/ekeventstore/defaultcalendarfornewreminders().md)
- [calendars(for:)](eventkit/ekeventstore/calendars(for:).md)
- [calendar(withIdentifier:)](eventkit/ekeventstore/calendar(withidentifier:).md)
- [removeCalendar(_:commit:)](eventkit/ekeventstore/removecalendar(_:commit:).md)
- [calendars](eventkit/ekeventstore/calendars.md)
