EKReminder with RecurrenceRules

397 Views Asked by At

I was work on fetching reminder, I have no problem fetching title, last modified date, notes, etc but I only have problem is recurrenceRules. Here my code:

print(get_reminder_detail.recurrenceRules)

And when I ran the app, it said:

[EKRecurrenceRule <0x28051c1e0> RRULE FREQ=WEEKLY;INTERVAL=1;UNTIL=20200815T061923Z]

As I see two things I am not sure how to pull information from this...first, how can I take FREQ and INTERVAL into the string? Second, how can I pull the UNTIL into the DateComponents?

2

There are 2 best solutions below

0
matt On BEST ANSWER

Do not look at the string that is used to print out the recurrence rule in the console. Look at the properties of the recurrence rule itself.

https://developer.apple.com/documentation/eventkit/ekrecurrencerule

Everything you need is right there.

0
AudioBubble On

I just realized it, I found the resolved. Here the codes:

if let getrecurrence = get_reminder_detail.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!")}
}

I guess I ask question too early