简体   繁体   English

查看EkReminder复发频率的最佳方法?

[英]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? 从EKEventStore加载提醒时,确定提醒具有哪种类型的重复频率的最佳方法是什么?

So far I have been able to see if the reminder contains a recurrenceRule using: 到目前为止,我已经能够使用以下命令查看提醒是否包含recurrenceRule:

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 每个EKCalendarItem都有一个重复规则数组recurrenceRulesEKRecurrenceRule的实例

Therefore, you can check for example: 因此,您可以检查例如:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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