         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

        }
    }
    
    public weak var appearance: YMCalendarAppearance!

    public weak var delegate: YMCalendarDelegate!
    
    public weak var dataSource: YMCalendarDataSource!
    
    public var calendar = Calendar.current {
        didSet {

        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
