How to Use Protocols to Fix a Cluttered UICollectionView in Swift
See the original posting on DZone Python
UICollectionView is a way of arranging a content grid or a list of subviews (
UICollectionViewCells) in a scrollable view. Collection views are ubiquitous: Instagrams Search page, Chromes tabs overview, or your Favorites lists on media streaming services like Netflix and Crave. All of these examples use a
UICollectionView to display cells.
For this article, Ive been working with Clearbridge Mobile iOS Developer, Conor Masterson, to learn about collection views and resolving the issue of code clutter that sometimes happens when recycling
UICollectionViewCells. This post will specifically explore how to implement a protocol for brevity in collection view code. Credit goes to Conor for writing the sample application that goes along with this article. If youd like to look at the full configuration code, there is a GitHub link at the end of the post.