Swift and enums #2
Continuing where we left off last time, is another little trick I like to use with enums:
func collectionView(_ collectionView: UICollectionView, layout: UICollectionViewLayout, referenceSizeForFooterInSection section: NSInteger) -> CGSize {
if .products == Section(rawValue: section), conditionOne, !conditionTwo {
return CGSize(width: 10, height: 20)
}
else if .shippingDetails == Section(rawValue: section), anotherCondition {
return CGSize(width: 10, height: 40)
}
return .zero
}