user12616082
user12616082

Reputation:

EKReminder with RecurrenceRules

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?

Upvotes: 1

Views: 457

Answers (2)

user12616082
user12616082

Reputation:

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

Upvotes: 1

matt
matt

Reputation: 535889

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.

Upvotes: 1

Related Questions