UITableView with Collapsible (expand and collapse) Cells

--

Many times we see the use-case like tableview cells should expand and collapse when tapped, let us see one easy implementation for the same in this article:

Let us create a TableViewController with a custom cell. The cell can be configured with three views

  1. Cell View — to display the cell contents in default mode
  2. Expanded View (Detail View) — to display the cell contents in expanded mode
  3. A container view (UIStackView) to hold both the Cell and Detail Views

So the CustomCell looks like this:

This article is updated and moved to my website here 😀 😀 😀

--

--