I just can’t solve the header connection problem.
It always goes into error. I didn't find anything on Google
This is register custom header
collectionDescriptionView.register(
HeaderForPictureView.self,
forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader,
withReuseIdentifier: HeaderForPictureView.identifierID
)
Add custom Header
func collectionView(
_ collectionView: UICollectionView,
viewForSupplementaryElementOfKind kind: String,
at indexPath: IndexPath
) -> UICollectionReusableView {
switch kind {
case UICollectionView.elementKindSectionHeader:
let headerView = collectionView.dequeueReusableSupplementaryView(
ofKind: kind,
withReuseIdentifier: HeaderForPictureView.identifierID,
for: indexPath
)
print(headerView)
return headerView
case UICollectionView.elementKindSectionFooter:
let sectionFooter = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: HeaderForPictureView.identifierID, for: indexPath)
return sectionFooter
default:
assert(false, "Unexpected element kind")
}
}
Error
Thread 1: "could not dequeue a view of kind: UICollectionElementKindSectionFooter with identifier HeaderForPictureView.header - must register a nib or a class for the identifier or connect a prototype cell in a storyboard"