如何在swift中最好地创建EKRecurrenceRule
以允许每周安排一次事件,可能每周安排一次。
例如,每周五和周六每周都会举办一次新活动。
var dayOfWeek = [EKWeekday.Friday, EKWeekday.Saturday]
EKRecurrenceRule(recurrenceWithFrequency: EKRecurrenceFrequency.Weekly, interval: 1, daysOfTheWeek: dayOfWeek)
目前,上述不起作用
如何制定这个?
(swift的示例和教程很稀疏)
答案 0 :(得分:5)
这应该这样做:
let friday = EKRecurrenceDayOfWeek(.Friday)
let saturday = EKRecurrenceDayOfWeek(.Saturday)
EKRecurrenceRule(recurrenceWithFrequency: .Weekly, interval: 1, daysOfTheWeek: [friday, saturday], daysOfTheMonth: nil, monthsOfTheYear: nil, weeksOfTheYear: nil, daysOfTheYear: nil, setPositions: nil, end: nil)