iOS EventKit Accessing different types of calendars

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!


Accessing the array of calendars

To access the array of EKCalendars, we use the calendarsForEntityType method:


let calendarsArray = eventStore.calendarsForEntityType(EKEntityType.Event) as! [EKCalendar]

Iterating through calendars

Just use a simple for loop:


for calendar in calendarsArray{

Accessing the calendar title and color


let calendarColor = UIColor(CGColor: calendar.CGColor)
let calendarTitle = calendar.title


UIColor *calendarColor = [UIColor initWithCGColor: calendar.CGColor];
NSString *calendarTitle = calendar.title;

Got any iOS Question?