Normally I just use this function:
optional func collectionView(_ collectionView: UICollectionView,
layout collectionViewLayout: UICollectionViewLayout,
minimumLineSpacingForSectionAt section: Int) -> CGFloat
to set some spacing between the items in a collectionView, but the spacing is the same for all items. I would like to set the spacing to be different between some items, depending on some logic that I need to check, the logic will depend on which cell is before and after, so I would need something like IndexPath to check that.
When we want to set size of a cell, we conveniently get IndexPath from the function below, but not from the function above.
optional func collectionView(_ collectionView: UICollectionView,
layout collectionViewLayout: UICollectionViewLayout,
sizeForItemAt indexPath: IndexPath) -> CGSize
What can I do to achieve this?