Como atribuir altura dinâmica ao UITableView

Eu tenho umUITableView no meu código

tableView = UITableView(frame: CGRect(x:0,y:0,width:0,height:0))
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cellReuseIdentifier")
tableView.delegate = self
tableView.dataSource = self
tableView.translatesAutoresizingMaskIntoConstraints = false
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return comments.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    let cell:UITableViewCell = self.tableView.dequeueReusableCell(withIdentifier: "cellReuseIdentifier") as UITableViewCell!

    cell.textLabel?.text = self.comments[indexPath.row]
    return cell
}

E eu quero dar uma altura dinâmica para este UITableView.I tentei duas coisas

   tableView.estimatedRowHeight = 88.0
   tableView.rowHeight = UITableViewAutomaticDimension

   tableView.heightAnchor.constraint(equalToConstant: tableView.contentSize.height).isActive = true

E nenhum deles funcionou.

questionAnswers(1)

yourAnswerToTheQuestion