I'm using JTAppleCalendar library in my app. Week ago I faced strange issue when func calendar(_ calendar: JTAppleCalendarView, didSelectDate date: Date, cell: JTAppleCell?, cellState: CellState)
stoped working in App Store version but it was working in current dev branch.
After quick research I've found that only thing that changed was FBSDKCoreKit
and FBSDKLoginKit
cocoapods versions - 4.34.0
. So I decide to update their versions to 4.38.1
and it resolved an issue.
Unfortunatly I can reproduce this issue only in my project(which is comercial) that has other libraries, VIPER architecture and for obvious reasons I can't share it.
However I don't think that pods can lead to such issue, so I'm trying investigate what could cause such problem. After few hours I found that delegate
of UICollectionView
is nil and that's why didSelectItemAt
is not responding.
I checked it simply by putting breakpoint after
super.dataSource = self
super.delegate = self
in InternalActionFunctions.swift
file and super.delegate
was nil
.
In
JTAppleCalendarVariables.swift
file I've found that author made delegate
and dataSource
variables private with next code
@available(*, unavailable)
/// Will not be used by subclasses
open override var delegate: UICollectionViewDelegate? {
get { return super.delegate }
set { /* Do nothing */ }
}
@available(*, unavailable)
/// Will not be used by subclasses
open override var dataSource: UICollectionViewDataSource? {
get { return super.dataSource }
set {/* Do nothing */ }
}
Commenting this code resolves my issue, delegate
has assigned value and everything works perfectly.
So my question is how above code can lead to such weird issues when in some cases didSelectItemAt
method works and in others it doesn't? or maybe I'm on wrong way and it couldn't be a reason at all?