Swift stuck with occurrenceDate and birthdayContactIdentifier

64 Views Asked by At

I've success with EKEvent include calendar identifier, title, start/end time, etc...but only two left I am stuck with is occurrenceDate and birthdayContactIdentifier. Here my code where I am stuck:

if let getbirthday = get_event.birthdayContactIdentifier {
   print(getbirthday.description)
}

This will show contact identifier, which work fine but how can I link to contact with identifier?

if let getoccurrence = get_event.occurrenceDate {
   print(getoccurrence.description)
}

The result show:

2020-05-30 02:00:00 +0000
2020-05-29 06:00:00 +0000

I am not sure why it show May 30 at 2am and May 29 at 6am because I put 8pm to 10:30pm, repeating every weekly. How can I get my app know how often repeating and what time?

Thanks for help!

1

There are 1 best solutions below

0
AudioBubble On

I found the issue. I use the code:

if let getrecurrence = get_event.recurrenceRules?.first {
   if getrecurrence.frequency == .daily {print("daily!")}
   if getrecurrence.frequency == .monthly {print("monthly!")}
   if getrecurrence.frequency == .weekly {print("weekly!")}
   if getrecurrence.frequency == .yearly {print("yearly!")}
}