Instance Method

enumerateEvents(matching:using:)

Finds all events that match a given predicate and calls a given callback for each event found.

Declaration

func enumerateEvents(matching predicate: NSPredicate, using block: @escaping EKEventSearchCallback)

Parameters

predicate

The search predicate. Must be created with the predicateForEvents(withStart:end:calendars:) method.

block

The block callback to call for each event. The callback must match the signature defined by EKEventSearchCallback.

Discussion

Only events that have been committed are included in enumeration. Events saved using save(_:span:commit:) with the commit parameter set to false must call commit() beforehand to be included.

This method is synchronous. For asynchronous behavior, run the method on another thread with dispatch_async(_:_:) or Operation.

See Also