How to self adjust the uItableview Cell element.
automatic adjust of UITableViewCell size.
So, there are two lines of code to make your cellHeight self sizing.
tableView.rowHeight = UITableViewAutomaticDimension
tableView.estimatedRowHeight = 140 // set your estimatedHeight
But, be sure that your constraints in cell are installed right, and views have an intrinsic content size.
See this tutorial for more information https://www.raywenderlich.com/129059/self-sizing-table-view-cells