iOS Accessing different types of calendars


Example

Accessing the array of calendars

To access the array of EKCalendars, 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;