Calling cell.layoutIfNeeded() before returning from tableView(_:, cellForRowAt indexPath:) forces resizing its internal elements and its height will be calculated correctly on the first usage.
This shouldn't always be done but solves cases where there could be some delayed calculation going on for the next run loop.
Topic:
UI Frameworks
SubTopic:
UIKit
Tags: