简体   繁体   中英

Best way to see a EkReminder recurrence frequency?

When loading a reminder from the EKEventStore, what is the best way to determine what type of recurrence frequency the reminder has?

So far I have been able to see if the reminder contains a recurrenceRule using:

if reminder.hasRecurrenceRules {
  if true {
    print("Reminder has recurrence rule")
  }
}

But as this only returns a boolean. I was wondering how best I can return a reminders recurrence frequency (ie if the recurrence rule is .daily or .weekly). Do I need to use a different method and if so, how?

I'm a complete rookie at this so I hope some of this makes sense, I could be completely off the ball…

I really appreciate any help and guidance! Thank you!

Every EKCalendarItem has an array of recurrence rules recurrenceRules , instances of EKRecurrenceRule

Therefore, you can check for example:

if let recurrenceRule = reminder.recurrenceRules.first {
   if recurrenceRule.frequence == .daily {
      // do something
   }
}

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