Instance Method

save(_:span:commit:)

Saves an event or recurring events to the event store by either batching or committing the changes.

Declaration

func save(_ event: EKEvent, span: EKSpan, commit: Bool) throws

Parameters

event

The event to be saved.

span

The span to use. Indicates whether the save affects future instances of the event in the case of a recurring event.

commit

To save the event immediately, pass true; otherwise, the change is batched until the commit() method is invoked.

error

The error that occurred, if any; otherwise, nil.

Return Value

If successful, true; otherwise, false. Also returns false if event does not need to be saved because it has not been modified.

Discussion

This method raises an exception if it is passed an event from another event store.

When an event is saved, it is updated in the Calendar database. Any fields you did not modify are updated to reflect the most recent value in the database. If the event has been deleted from the database, it is re-created as a new event.

See Also

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software