CalendarPermissionsValidator

open class CalendarPermissionsValidator

Validates the permissions for the app to access the calendar.

Subspec: Utility/CalendarPermissionsValidator

private lazy var calendarPermissionsValidator: CalendarPermissionsValidator = {
    let validator = CalendarPermissionsValidator()
    validator.delegate = self
    return validator
}()

calendarPermissionsValidator.addEventToCalendar(eventInfo: eventCalendarInfo)

The CalendarPermissionsValidator uses the default EKEventStore to add an event to a user’s calendar if the necessary permissions are given.

  • Default event store from the EventKit.

    Declaration

    Swift

    private static var eventStore: EKEventStore
  • Default initializer

    Declaration

    Swift

    public init()
  • Checks the current calendar’s permissions.

    Declaration

    Swift

    func checkCalendarPermissions(status: EKAuthorizationStatus, eventInfo: EventCalendarInfo)

    Parameters

    status

    Status of the calendar permissions.

    eventInfo

    User’s event info to add to calendar.

  • Requests the current user’s permissions with the given parameter.

    Declaration

    Swift

    func requestCalendarPemissions(eventInfo: EventCalendarInfo)

    Parameters

    eventInfo

    Event info to add to the calendar.

  • Adds the event infor to the calendar if it is not already found.

    Declaration

    Swift

    func addToCalendar(eventInfo: EventCalendarInfo)

    Parameters

    eventInfo

    Event info to add to the calendar.

  • Determines if the event info provided is already found in the calendar.

    Declaration

    Swift

    func eventFoundInCalendar(eventInfo: EventCalendarInfo) -> Bool

    Parameters

    eventInfo

    Event info to add to the calendar.

    Return Value

    Flag that determines if the event was found.

  • Generates an EKEvent from the EventCalendarInfo.

    Declaration

    Swift

    func newEvent(eventInfo: EventCalendarInfo) -> EKEvent

    Parameters

    eventInfo

    Event info used to convert to an EKEvent.

    Return Value

    EKEvent from the EventCalendarInfo.