title: Programmatically Create a Custom Table View as a Popup
body: <p>Like the title says, I'm working on an Xcode project using Swift 3.0. I'd like to have, my current view, on a button click, display a smaller view as a pop up. 
   This pop up will be a Table View that will display one label + one text box for as many cells are in a certain array. The size will be limited to a piece of the screen and the table view will naturally be scrollable.</p>
  
  <p>I understand how to programmatically create a view and I got the "hidden = true" concept. What I'm really struggling with is getting the Table View in it. Theoretically I could design the view in my storyboard, but would there be a way to reference it by name and super impose it over the current view?</p>
  
  <p>Thanks for the help!</p>
  
  <p>Edit:</p>
  
  <p>Thanks to some help I got as far as this code:</p>
  
  <pre><code>    @IBOutlet weak var CreatePost: UIButton!
  @IBAction func CreatePost(_ sender: Any) {
      let storyboard = UIStoryboard(name: "Main", bundle: nil)
      let popVC = storyboard.instantiateViewController(withIdentifier: "CreateAccountPop") // your viewcontroller's id
      popVC.preferredContentSize = CGSize(width: 500, height: 600)
      popVC.modalPresentationStyle = .popover
      let popover =  popVC.popoverPresentationController
      popover?.delegate = self as? UIPopoverPresentationControllerDelegate
      //sourceRect and sourceView is required in case of iPad
      popover?.sourceRect = (sender as AnyObject).frame //give anchor frame
      popover?.sourceView = sender as! UIView //give anchor view
      self.present(popVC, animated: true, completion: nil)
  }
  </code></pre>
  
  <p>The code displays the view controller but it takes up the entire screen. I can't seem to figure out how to limit its size</p>