title: How to programmatically select a row in UITableView in Swift
body: <p>I need to select a row in a UITableView programmatically using Swift 1.2. </p>
  
  <p>This is the simple code:</p>
  
  <pre><code>var index = NSIndexPath(forRow: 0, inSection: 0)
  self.tableView.selectRowAtIndexPath(index, animated: true, scrollPosition: UITableViewScrollPosition.Middle)
  self.tableView(self.tableView, didSelectRowAtIndexPath: index)
  </code></pre>
  
  <p>The above gives me the following error:</p>
  
  <blockquote>
    <p><strong>Cannot invoke 'selectRowAtIndexPath' with an argument list of type '(NSIndexPath!, animated: Bool, scrollPosition: UITableViewScrollPosition)'</strong></p>
  </blockquote>
  
  <p>What is wrong with my Swift 1.2 code?</p>
  
  <p>My UItableView has been created in IB in the UIViewController that I am trying to call the code above. 
  When I put the code in a UITableViewController the compiler does not give any errors.
  Do I need to embed a UITableViewController in a container or is there another way?</p>