I tried following this solution (How to determine height of UICollectionView with FlowLayout) to determine the size of my UICollectionViewLayout in order to size cells accordingly. My code below calls the collectionViewContentSize, which throws an error upon being called:
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
let frameWidth = collectionViewLayout.collectionViewContentSize.width
let maxCellWidth = (frameWidth) / (7.0/6.0 + 6.0)
let frameHeight = collectionViewLayout.collectionViewContentSize.height
let maxCellHeight = frameHeight
let cellEdge = maxCellWidth < maxCellHeight ? maxCellWidth : maxCellHeight
return CGSize(width: cellEdge, height: cellEdge)
}
The error is the Thread 1 SIGABRT.
Any idea why this does not work?