1️⃣What is a UICollectionView?

Fall 2023 | Vin Bui

What is a UICollectionView?

Similar to a UITableView, a UICollectionView is a sub-class of UIScrollView. In other words, it is also a scrollable view. However, a collection view is more dynamic and customizable than a table view. A collection view still contains sections, but instead of rows in a table view, it uses items. Each item is represented by a UICollectionViewCell and can be displayed in a grid-like manner. Additionally, a UICollectionView also supports horizontal scrolling.

Examples of a UICollectionView

Breaking Down a UICollectionView

A UICollectionView contains sections where each section contains items, and each item being represented by a cell. If we look at the Spotify example above, we can see 3 sections, each having its own header. For example, the top section has the header “Made For vinnie”. Now, each section contains items, which are represented by a UICollectionViewCell. In each section, the square image is a UICollectionViewCell. If you have used Spotify before, then you know that these sections are horizontally scrolled.

As we can see, a UICollectionView is a lot more versatile and customizable than a UITableView. It allows for horizontally scrolling as well as laying items out in grid-like manner.

Last updated