Instance Method

events(matching:)

Returns all events that match a given predicate.

Declaration

func events(matching predicate: NSPredicate) -> [EKEvent]

Parameters

predicate

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

Return Value

All events that match predicate, as an array of EKEvent objects.

Discussion

Only events that have been committed are included in the results. 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