title: How do I adjust my popover to the size of the content in my tableview in swift?
body: <p>I'm using <code>popoverPresentationController</code> to show my popover. The <code>UITableViewController</code> used to show as popover is created programmatically and will usually contain 1 to 5 rows. How do I set up this popover to adjust the size to the content of the tableview?</p>
  
  <p>Code for my popover:</p>
  
  <pre><code>if recognizer.state == .Began {
      let translation = recognizer.locationInView(view)
  
      // Create popoverViewController
      var popoverViewController = UITableViewController()
      popoverViewController.modalPresentationStyle = UIModalPresentationStyle.Popover
      popoverViewController.tableView.backgroundColor = UIColor.popupColor()
  
      // Settings for the popover
      let popover = popoverViewController.popoverPresentationController!
      popover.delegate = self
      popover.sourceView = self.view
      popover.sourceRect = CGRect(x: translation.x, y: translation.y, width: 0, height: 0)
      popover.backgroundColor = UIColor.popupColor()
  
      presentViewController(popoverViewController, animated: true, completion: nil)
  }
  </code></pre>