I am using EventKit to fetch all events from the default Apple Calendar in my app. When there is a custom recurring event in the Apple Calendar with multiple days of recurrence then EventKit returns an array of daysOfTheWeek in the recurrence rule What I mean is Event_A is recurring weekly every Friday and Saturday then EventKit returns an array of objects like this
calendar = "testingcurvecalendar@gmail.com";
endDate = "2022-07-30 11:00:00";
id = "5FFF5521-18BB-497C-8EF5-4E72647A6A24:2AE552B8-85C4-489C-8A36-DACF95D83E61";
lastModifiedDate = "2022-05-20 10:25:01";
rrule = {
calendar = gregorian;
daysOfTheWeek = (
{
dayOfTheWeek = Friday;
weekNumber = 0;
},
{
dayOfTheWeek = Saturday;
weekNumber = 0;
}
);
freq = weekly;
interval = 1;
until = {
count = 0;
date = "2022-07-31 23:59:59";
};
};
startDate = "2022-07-30 10:00:00";
title = MultipledayswithEnd;
},
But if an event is recurring for only single day then eventkit does not return daysOfTheWeek object i.e. Event_B is recurring weekly every Monday then the object received from the eventkit is as follows
calendar = "testingcurvecalendar@gmail.com";
endDate = "2022-07-27 11:00:00";
id = "5FFF5521-18BB-497C-8EF5-4E72647A6A24:C57AFD95-75A0-4F75-B4F0-00D7321BFB21";
lastModifiedDate = "2022-05-20 10:27:23";
rrule = {
calendar = gregorian;
freq = weekly;
interval = 1;
until = {
count = 0;
date = "2022-07-31 23:59:59";
};
};
startDate = "2022-07-27 10:00:00";
title = Singlewithend;
},
The issue is I would like to display the day of recurrence in my app which I am able to in case of Multi-day recurring events because I receive the days in dayOfTheWeek object but I cannot do it in Single-day recurring events.
The code for fetching events from the Calendar is as follows
NSPredicate *fetchCalendarEvents = [eventStore predicateForEventsWithStartDate:[NSDate date] endDate:endDate calendars:calendarArray];
NSArray *matchingEvents = [eventStore eventsMatchingPredicate:fetchCalendarEvents];
NSMutableArray * eventsDataArray = [self eventsToDataArray:matchingEvents];
Can someone please help me with this issue?