In my iOS app i used to access calendar with the following method:
EKCalendar* cal = [eventStore calendarWithIdentifier:[calendarIDs objectAtIndex:i]];
Instead of
let matchedCal = eventStore .calendar(withIdentifier: calendarIdentifier)
You can use:
let matchedCal = eventStore .calendars(for: .event) .first(where: { $0.calendarIdentifier == calendarIdentifier })