In UICollectionView, I want to give the whole section a uniform background color, instead of for a single cell or for the whole collection view.
I don\'t see any de
Its very simple just use this default UICollectionViewDelegate's method, it will works
func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
print(indexPath.item)
let evenSectionColor = UIColor.clear
let oddSectionColor = UIColor.white
cell.contentView.backgroundColor = (indexPath.item % 2 == 0) ? evenSectionColor : oddSectionColor
}