EventKitInterface
public class EventKitInterface : EventKitInterfaceProtocol
Provides a basic mechanism for interacting with the EventKit framework.
Conforms to the EventKitInterfaceProtocol protocol.
Seealso
EventKitHandler
-
Initialize object with the
EKEventStoreand with a start and an end date.If the event store is not provided a new one is created. The start and the end date are used to filter events and reminders to remove.
Declaration
Swift
public init(eventSpan: EKSpan = .futureEvents, eventStartDate: Date = Date.yearAgo, eventEndDate: Date = Date.nextYear)Parameters
eventStoreAn event store used to communicate.
eventSpanIndicates whether modifications should apply to a single event or all future events of a recurring event.
eventStartDateA start date for items filtering. By default a year ago.
eventEndDateAn end date for items filtering. By default next year.
-
Adds all calendar items to the
EKEventStore.Declaration
Swift
public func addAll(_ calendarItems: [EKCalendarItem], forType type: EKEntityType, completion: @escaping EventKitInterfaceProtocol.CompletionBlock = { _, _ in })Parameters
calendarItemsList of calendar items, a subclasses of
EKCalendarItem.typeType of entity to add.
completionCompletion closure called after items were saved to the store.
-
Remove all calendar items from the
EKEventStore.Declaration
Swift
public func removeAll(ofType type: EKEntityType, completion: @escaping EventKitInterfaceProtocol.CompletionBlock = { _, _ in }) -
Request access to the
EventKitframework for given item type.Declaration
Swift
public func requestAccess(forType type: EKEntityType, completion: @escaping (Bool, Error?, EKEventStore?) -> Void)Parameters
typeType of entity to request access.
completionCompletion closure.
-
Checks if the application is authorized to use events or reminders.
Declaration
Swift
public static func authorized(forType type: EKEntityType) -> BoolParameters
typeThe type of entity (events or reminders) to check.
Return Value
trueif the application was authorized,falseotherwise.
EventKitInterface Class Reference