> For the complete documentation index, see [llms.txt](https://ios-course.cornellappdev.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ios-course.cornellappdev.com/resources/textbook/uicollectionview/what-is-a-uicollectionview.md).

# What is a UICollectionView?

### 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

<div><figure><img src="/files/62SfqdeDQqkLALKRZEKv" alt="" width="375"><figcaption><p>Instagram</p></figcaption></figure> <figure><img src="/files/hPera2FnwanU2F58v9ch" alt="" width="375"><figcaption><p>Spotify</p></figcaption></figure></div>

### 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.
