查看EkReminder重复频率的最佳方法是什么?

时间:2016-07-06 16:17:47

标签: ios swift recurrence ekeventstore

从EKEventStore加载提醒时,确定提醒具有哪种类型的重复频率的最佳方法是什么?

到目前为止,我已经能够使用以下内容查看提醒是否包含recurrenceRule:

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

但是因为这只返回一个布尔值。我想知道如何最好地返回提醒重现频率(即,如果重复规则是.daily或.weekly)。我是否需要使用其他方法?如果是,请如何使用?

我是一个完整的新秀,所以我希望其中一些是有道理的,我可以完全脱离球......

我非常感谢任何帮助和指导!谢谢!

1 个答案:

答案 0 :(得分:0)

每个EKCalendarItem都有一系列重复规则recurrenceRulesEKRecurrenceRule的实例

因此,您可以检查例如:

if let recurrenceRule = reminder.recurrenceRules.first {
   if recurrenceRule.frequence == .daily {
      // do something
   }
}
相关问题