EKRecurrence rule iOS swift
Solution:
You can be use ekrecurrence rule for repeating the event scheduling without using for loop.
you can also add the alarm to the event.
recurrenceWithFrequency - it will be weekly,yearly,monthly,.daily
daily schedules with end date or without end date you can add.
If you given the monthly and start date it will be generated every month that date.In year every day,month it will be repeatable.
interval - it is used for interval of the event.
daysOfTheWeek - you can give the day numbers like sun -1,mon -2
daysOfTheMonth - you can give the value between 1-31 or -1 to -31
monthsOfTheYear - You can give the numbers with 1 to 12
end - end date you can give
Code:
let event = EKEvent(eventStore: self.eventStore)
event.title = title
event.startDate = fourthOfJulyStartDate
event.endDate = fourthOfJulyEndDate
event.addRecurrenceRule(EKRecurrenceRule(recurrenceWithFrequency: .Yearly,
interval: 4,
daysOfTheWeek: nil,
daysOfTheMonth: [NSNumber(int: 4)],
monthsOfTheYear: [NSNumber(int :7)],
weeksOfTheYear: nil,
daysOfTheYear: nil,
setPositions: nil,
end: nil))
You can be use ekrecurrence rule for repeating the event scheduling without using for loop.
you can also add the alarm to the event.
recurrenceWithFrequency - it will be weekly,yearly,monthly,.daily
daily schedules with end date or without end date you can add.
If you given the monthly and start date it will be generated every month that date.In year every day,month it will be repeatable.
interval - it is used for interval of the event.
daysOfTheWeek - you can give the day numbers like sun -1,mon -2
daysOfTheMonth - you can give the value between 1-31 or -1 to -31
monthsOfTheYear - You can give the numbers with 1 to 12
end - end date you can give
Code:
let event = EKEvent(eventStore: self.eventStore)
event.title = title
event.startDate = fourthOfJulyStartDate
event.endDate = fourthOfJulyEndDate
event.addRecurrenceRule(EKRecurrenceRule(recurrenceWithFrequency: .Yearly,
interval: 4,
daysOfTheWeek: nil,
daysOfTheMonth: [NSNumber(int: 4)],
monthsOfTheYear: [NSNumber(int :7)],
weeksOfTheYear: nil,
daysOfTheYear: nil,
setPositions: nil,
end: nil))
Comments
Post a Comment