         var comps = DateComponents()
         comps.day = indexPath.section
         guard let date = calendar.date(byAdding: comps, to: view.referenceDate),
-            let shouldDeselect = delegate.calendarView?(self, shouldDeselectEventAtIndex: indexPath.item, date: date) else {
+            let shouldDeselect = delegate?.calendarView?(self, shouldDeselectEventAtIndex: indexPath.item, date: date) else {
                 return true
         }
         return shouldDeselect

        var comps = DateComponents()
        comps.day = indexPath.section
        guard let date = calendar.date(byAdding: comps, to: view.referenceDate),
            let shouldSelect = delegate.calendarView?(self, shouldSelectEventAtIndex: indexPath.item, date: date) else {
            return true
        }
        return shouldSelect

            selectedEventIndex = 0
        }
        
        delegate?.calendarView?(self, didDeselectEventAtIndex: indexPath.item, date: date)
    }
}

