---
title: "#161: UITableView vs. UICollectionView ⚔"
url: https://littlebitesofcocoa.com/161-uitableview-vs-uicollectionview
author: Jake Marsh
published: 2016-01-04
topics: ["Techniques","UIKit"]
description: "Today we'll tackle a common question from those beginning to learn iOS development: \"UICollectionView and UITableView seem to overlap in terms of..."
---

# #161: UITableView vs. UICollectionView ⚔

By Jake Marsh, January 4, 2016. HTML: https://littlebitesofcocoa.com/161-uitableview-vs-uicollectionview

Today we'll tackle a common question from those beginning to learn iOS development:

<center><i>"<strong>UICollectionView</strong> and <strong>UITableView</strong> seem to overlap in terms of functionality in many ways. When should I use one or the other?"</i></center>

The practical answer is actually a common idiom when building software: <i>What's the simplest possible solution?</i>

Let's look at the basics of _table_ and _collection views_, then we'll circle back and learn how we apply that answer to our question.

_UITableViews_ are all about vertically scrolling lists of content. They expect us to use them to display rows of content inside sections. We get a ton of conventional "iOS-native" feeling functionality for free such as group-style _table views_ that look like iOS's settings app or system-standard accessory views.

In short: _UITableViews_ give us a lot for free, but they expect us to think in their terms.

_UICollectionViews_ are <i>infinitely</i> more customizable than _Table Views_. We can completely customize a _collection view's_ **layout**, even animate between **layouts**.

_UICollectionViews_ don't provide anywhere near as much functionality out of the box, but they offer an <i>incredible</i> amount of power and capability.

In many ways, _Collection Views_ are the  more-capable big sister to _Table Views_. They aren't constrained by "rows" or "accessory views". They are great for simple grids, all the way up to [incredibly](https://github.com/fmitech/FMMosaicLayout) [complex](https://github.com/onevcat/VVSpringCollectionViewFlowLayout) [layouts](https://github.com/solomidSF/YRCoverFlowLayout).

Back to our original answer: <i>What's the simplest possible solution?</i>

We can now answer our question by rephrasing it: <i>Given what I'd like to build, will a </i>UITableView<i> or a </i>UICollectionView<i> help me get there faster, with less (or at least simpler) code?</i>

Building a Settings screen or vertical list of social media posts? A _UITableView_ is probably the way to go.

Building a photo gallery, or perhaps a screen that needs to scroll content horizontally? We'll need a _UICollectionView_ for those.

In either case, if we ever start to feel like we're fighting against **UIKit**, that's a good time to step back and re-evaluate.
