We are also experiencing an app crash issue in the viewForSupplementaryElementOfKind method:
func collectionView(_ collectionView: UICollectionView,
viewForSupplementaryElementOfKind kind: String,
at indexPath: IndexPath) -> UICollectionReusableView {
switch kind {
case UICollectionView.elementKindSectionHeader:
let headerView = collectionView.dequeueReusableSupplementaryView(
ofKind: kind,
withReuseIdentifier: headerViewIdentifier, for: indexPath)
return headerView
case UICollectionView.elementKindSectionFooter:
let footerView = collectionView.dequeueReusableSupplementaryView(
ofKind: kind,
withReuseIdentifier: footerViewIdentifier, for: indexPath)
return footerView
default:
break
}
}
As @KSmith95 mentioned, we also tried using supplementaryView, but it always returns nil and leading the app crash.