<!--
{
  "availability" : [
    "iOS: 5.0.0 -",
    "iPadOS: 5.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.8.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "EventKit",
  "identifier" : "/documentation/EventKit/EKEventStore/commit()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "EventKit"
    ],
    "preciseIdentifier" : "c:objc(cs)EKEventStore(im)commit:"
  },
  "title" : "commit()"
}
-->

# commit()

Commits all unsaved changes to the event store.

```
func commit() throws
```

## Discussion

This method allows you to save batched changes to the event store. For example, if you pass <doc://com.apple.documentation/documentation/Swift/false> as the `commit` parameter to the [`saveCalendar(_:commit:)`](/documentation/EventKit/EKEventStore/saveCalendar(_:commit:)), [`removeCalendar(_:commit:)`](/documentation/EventKit/EKEventStore/removeCalendar(_:commit:)), [`save(_:span:commit:)`](/documentation/EventKit/EKEventStore/save(_:span:commit:)), or [`remove(_:span:commit:)`](/documentation/EventKit/EKEventStore/remove(_:span:commit:)) methods, the changes aren’t saved until [`commit()`](/documentation/EventKit/EKEventStore/commit()) is invoked. Likewise, if you pass <doc://com.apple.documentation/documentation/Swift/true> as the `commit` parameter to the above methods, you don’t need to call [`commit()`](/documentation/EventKit/EKEventStore/commit()).

> Handling Errors in Swift:
> 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](https://docs.swift.org/swift-book/LanguageGuide/ErrorHandling.html) in [The Swift Programming Language](https://docs.swift.org/swift-book/) and `About Imported Cocoa Error Parameters`.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)
