Table & Collection Views

June 02, 2026 1 min read

UITableView (lists) and UICollectionView (grids) display scrollable data efficiently by reusing cells.

A simple table

class ListVC: UITableViewController {
    let items = ["One", "Two", "Three"]

    override func tableView(_ t: UITableView, numberOfRowsInSection s: Int) -> Int {
        items.count
    }
    override func tableView(_ t: UITableView, cellForRowAt ip: IndexPath) -> UITableViewCell {
        let cell = t.dequeueReusableCell(withIdentifier: "cell", for: ip)
        cell.textLabel?.text = items[ip.row]
        return cell
    }
}
Tip: Modern apps use diffable data sources for automatic, animated updates when the data changes.

Summary

Table and collection views render large lists/grids efficiently via cell reuse and a data source.