Created
June 19, 2021 17:54
-
-
Save froggomad/55e2edaff6092d76322404bac7301fa3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension TitledCollectionView: UICollectionViewDelegate { | |
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { | |
updateControllerDelegate(with: indexPath.item) | |
} | |
private func updateControllerDelegate(with item: Int) { | |
switch self.produce { | |
case .fruit: | |
let fruit = Fruit.allCases[item] | |
print(produce?.description, fruit.description) | |
case .vegetable: | |
let vegetable = Vegetable.allCases[item] | |
print(produce?.description, vegetable.description) | |
default: // nil value | |
break | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment