简体   繁体   中英

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?

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM