I get the data from API that divided into pages, I user var hasMoreUsers: Bool
to show/hide the footer cell
func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForFooterInSection section: Int) -> CGSize {
if hasMoreUsers {
return CGSizeMake(collectionView.contentSize.width, 50)
} else {
return CGSizeZero
}
}
The code brake on the last page where I set hasMoreUsers = false
and calling self.collectionView.performBatchUpdates
to add the data
Here is the error
Got this error at line calling self.collectionView.performBatchUpdates
*** Assertion failure in -[UICollectionViewData layoutAttributesForSupplementaryElementOfKind:atIndexPath:], /SourceCache/UIKit_Sim/UIKit-3347.44/UICollectionViewData.m:884
Follow by
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'no UICollectionViewLayoutAttributes instance for -layoutAttributesForSupplementaryElementOfKind: UICollectionElementKindSectionFooter at path <NSIndexPath: 0xc000000000000016> {length = 2, path = 0 - 0}'
Look like it need dimension for footer, but I already return CGSizeZero
for it and this should be the problem. Really confuse.