Taking first plunge with collection views and am running into this error:
Terminating app due to uncaught exception \'NSInternalInconsistencyException
Swift 5
1) Make sure you have a correct deque for HEADER, you might be using the regular for normal cells.
override func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
let header = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: headerId, for: indexPath)
return header
}
2) doubleCheck the registration (ViewDidLoad)
collectionView.register(HeaderCell.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: headerId)