Skip to content

Latest commit

 

History

History
5 lines (3 loc) · 867 Bytes

README.md

File metadata and controls

5 lines (3 loc) · 867 Bytes

Expand and collapse UITableViewCells with UIStackView

This project demonstrates expanding and collapsing UITableView cells. There are many approaches to this but using a UIStackView is currently (Xcode 10, Swift 5) the one that best handles cells with unique heights and supports auto layout. There are so many details to get right that I collected them in this simple project, rather than searching Stack Overflow each time I implement. Details like pinning the UIStackView to the cell’s contentView , setting tableView.rowHeight = UITableView.automaticDimension, setting variable line height UILabels Content Compression Resistance Priority, etc. are easy to overlook and may not manifest issues till runtime.

expandingCellsAnimation