Trying to add a a Supplementary view into my UICollectionView
as a header. I\'m having issues getting it to work.
I use a custom UICollectionViewFlowL
This answer is similar to the others where you create a method that checks for the data source, but it's a bit simpler. It seems the issue is related to the collection view's layout sticking around after the collection has been released. So I zeroed out the layout's properties as below and the error disappeared.
deinit {
let layout = self.collectionView.collectionViewLayout as! UICollectionViewFlowLayout
layout.estimatedItemSize = CGSizeZero
layout.sectionInset = UIEdgeInsetsZero
layout.headerReferenceSize = CGSizeZero
}