Accessing different types of calendars
suggest changeAccessing the array of calendars
To access the array of EKCalendar
s, we use the calendarsForEntityType
method:
Swift
let calendarsArray = eventStore.calendarsForEntityType(EKEntityType.Event) as! [EKCalendar]
Iterating through calendars
Just use a simple for
loop:
Swift
for calendar in calendarsArray{
//...
}
Accessing the calendar title and color
Swift
let calendarColor = UIColor(CGColor: calendar.CGColor)
let calendarTitle = calendar.title
Objective-C
UIColor *calendarColor = [UIColor initWithCGColor: calendar.CGColor];
NSString *calendarTitle = calendar.title;
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents