Did Apple Just Kill UITableView?

Build Lists in UICollectionView // WWDC style


  • You will be expected to be aware how to make a Single View Application in Swift.
  • You will need to have installed the Xcode 12 (beta) if you are going to create or download the Repo and run it — this uses features of iOS14!
  • I’ve a number of tutorials that can be helpful here: custom cells, optionals, UITableViews, and UICollectionViews and so on: However I’d recommend you read the article and see if it makes sense and then come back and look at the tutorial for the section that isn’t clear to you.


UICollectionView: An object that manages an ordered collection of data items and presents them using customizable layouts

The goal of this article

This article will show a UICollectionView where we can treat this list as a UITableView — including removing items. We are going to use UICollectionViewDiffableDataSource, updating a NSDiffableDataSourceSnapshot, and remove data items when the user slides cells like in any nice App with a half-decent user interfaces.

The application

This application is going to display the plantes of the solar system. The data to be displayed is the following:

var data = [“Mercury”, “Venus”, “Earth”, “Mars”, “Jupiter”, “Saturn”, “Uranus”, “Neptune”]

Configuring the collection view

At the class level, we have a dataSource and collectionView

var dataSource: UICollectionViewDiffableDataSource<Section, String>!var collectionView: UICollectionView!
Click for Gist

The layout

This function can be called from viewDidLoad() and allows us to create our list with an .insetGrouped appearance — and trust me this is the one we want!

Click for Gist

The data source

The idea is to use every other cell as a standard `UICollectionViewListCell` and the other cells as a `BasicCollectionViewCell` . To make the datasource release the right cell at the right time, here is a rather simple peice of logic that does just that:

Click for Gist
snapshot.appendSections([.main])snapshot.appendItems(Array(data))dataSource.apply(snapshot, animatingDifferences: false)

The cells

This example uses both a standard UICollectionViewListCell and a custom cell called BasicCollectionViewCell — to make it clear how we can use both a standard cell and a custom cell. There is nothing particularly special about my custom cell — but it is blue text in the cell to make it clear which one is which.

Cilck for Gist
Click for Gist
Click for Gist


For this article, the question is do we ever need to use UITableView again? You want the bad news? The APIs used here require iOS14 which means that you can’t yet publish any App on the App store (since Xcode 12 is in beta).

You’re going to have to wait, James

(If your name isn’t James, you’re going to have to wait anyway).

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store