Proper Use of CellForRowAtIndexPath and WillDisplayCell
Article Summary
Zalando's iOS team challenges a widely-cited performance myth about UITableView that's been misleading developers for years.
Engineer Yunus Eren Guzel investigates whether willDisplayCell actually improves scrolling performance over cellForRowAtIndexPath, a claim popularized in Alexander Orlov's influential article on UITableView optimization. Using layout cycle analysis and logging, he tests whether the timing difference matters.
Key Takeaways
- Both cellForRowAtIndexPath and willDisplayCell execute in the same layout cycle
- layoutSubviews runs after both methods, so neither displays cells faster
- Apple's documentation shows willDisplayCell is for overriding state properties only
- Performance bottlenecks affect scrolling regardless of which method you use
Critical Insight
Data binding location doesn't impact UITableView performance because both methods execute before layout in the same cycle.