iosswiftekeventekeventstore

Creating EKEvent with Unique Identifier(Not Editable)


I want to create an EKEvent to add it in device calendar. Is there any way to set a unique id (which a user can not edit in Calendar app) to this event so that I can identify or match it with my event.

I am creating event like this

let event = EKEvent.init(eventStore: eventStore)
event.title = "My location"
event.location = "Location Address"

// Setting Start - End Date
event.startDate = Date()
event.endDate = Date()

do {
    // Saving Events
    try eventStore.save(event, span: .thisEvent, commit: true)
    let message = "Schedule has been added to your device's calendar."
    showAlert(title: kFVApplicationTitle, message: message)
} catch {
    let message = "Schedule could not be added to your device's calendar."
    showAlert(title: kFVApplicationTitle, message: message)
}

Solution

  • Creating a Category for EKEvent and adding additional properties in it solves my problem.