title: How to add programmatic constraints to a UITableView?
body: <p>I have a class set up as follows:</p>
  
  <pre><code>class SettingsController: UITableViewController {
  </code></pre>
  
  <p>I would like to be able to add constraints to the UITableView so that there is equal spacing either side of the table (it is currently a full width table, so a little ugly on iPad).</p>
  
  <p>I have read that I can't add constraints to a <code>UITableViewController</code>, and instead I must add a <code>UIViewController</code> to my class, add a <code>UITableView</code> to that, and then I should be able to add the constraints to the TableView.</p>
  
  <p>I've amended the class and defined the <code>UITableView</code> on the next line. So here are my first two lines now:</p>
  
  <pre><code>class SettingsController: UIViewController {
    var tableView = UITableView()
  </code></pre>
  
  <p>Further down, I have this code to attach the TableView to the <code>UIView</code>:</p>
  
  <pre><code>override func viewDidLoad() {
      super.viewDidLoad()   
      self.view.addSubview(tableView)
  }
  </code></pre>
  
  <p>The app builds successfully but when trying to access this view, the screen is blank, so I've not been able to attempt the constraints part yet (the screen does display the data correctly if I revert what I've described).</p>
  
  <p>Many of my existing functions within this class reference <code>tableView</code> for passing in the data/setting the number of rows etc, but it seems I've not done something right... is there a piece I'm missing?</p>