title: UITableView created Programmatically doesn't Show anything
body: <p>im trying to generate a overlay with a table view, and afterwards adding a searchbar to the list
  but for now im struggling with the creation of the table view, as it needs to be done programmaticaly. </p>
  
  <p>The Overlay also shows correctly, but no entrys are shown.
  if i let print out the <code>UITableViewAutomaticDimension</code> it always returns -1 but in debug mode I can see that in <code>cellForRowAt</code> the cell is defined and has a height of 46 </p>
  
  <p>the problem didn't got solved if I returned this height by myself, either</p>
  
  <p>the code: </p>
  
  <pre><code>public class PersonOverlay : UITableView, UITableViewDelegate, UITableViewDataSource {
  
  var overlayView = UIView()
  var tableView = UITableView()
  
  let myArray = ["1","2","3","4"]
  
  
  
  public func showPersons(view: UIView) -&gt; UITableView {
  
      //create new opaque view to lay over the Main view
      self.overlayView = UIView(frame: UIScreen.main.bounds)
      self.overlayView.backgroundColor = UIColor(red: 1, green: 1, blue: 1, alpha: 0.8)
  
      //create a tableview to display possible inputs
      self.tableView.frame = CGRect(x:0,y:0, width:UIScreen.main.bounds.width, height:UIScreen.main.bounds.height/2)
      self.tableView.frame = UIScreen.main.bounds
      self.tableView.register(UITableViewCell.self, forCellReuseIdentifier: "PersonCell")
      self.tableView.delegate = self
      self.tableView.dataSource = self
  
      //add to overlay and afterwards to the view
      self.overlayView.addSubview(self.tableView)
      view.addSubview(self.overlayView)
  
      DispatchQueue.main.async {
          self.tableView.reloadData()
      }
  
      return tableView
  
  }
  
  public func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -&gt; CGFloat {
      //returns -1 ?
      print(UITableViewAutomaticDimension)
      return UITableViewAutomaticDimension
  }
  
  public func numberOfSections(in tableView: UITableView) -&gt; Int {
      return 1
  }
  
  public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
      //view clicked
      print("clicked at index \(indexPath.row)")
  }
  
  public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
      print("tableview numberofrowsinsection \(myArray.count)")
      return myArray.count
  }
  
  public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
  
      let cell = self.tableView.dequeueReusableCell(withIdentifier: "PersonCell") as! UITableViewCell
  
      print(String(describing: myArray[indexPath.row] ))
      cell.textLabel?.text = myArray[indexPath.row]
  
      return cell
  }
  
  }
  </code></pre>
  
  <p>It gets called from another ViewController Showing some other informations</p>
  
  <p>I hope anybody can help and appreciate your Time :)</p>