title: Keep selected rows when dismissing UITableViewController - Swift, UITableView
body: <p>Does anyone know how to keep the rows selected/highlighed in UITableView when you move from a new View Controller back to your UITableView?</p>
  
  <p>When I make a selection and dismiss the table view controller, the selection is no longer there when I return. I set clearsSelectionOnViewWillAppear to false inside <code>super.viewDidLoad</code> but that didn't work, someone on StackOverflow mentioned doing the following:</p>
  
  <pre><code>class TableViewController:
  UITableViewController,
  UITableViewDelegate,
  UITableViewDataSource {
  
  
  @IBOutlet weak var drugTableView: UITableView!
  
  override func viewDidLoad()
      {
      super.viewDidLoad()
      self.clearsSelectionOnViewWillAppear = false
  
      }
  
  
  override func viewWillAppear(animated: Bool) {
  
  let indexPaths = self.drugTableView.indexPathsForSelectedRows() as [NSIndexPath]
  
  self.tableView.selectRowAtIndexPath(indexPath: indexPaths, animated: true, scrollPosition: UITableViewScrollPosition.None)
  
  }
  </code></pre>
  
  <p>but that won't compile due to this error:</p>
  
  <p><code>self.tableView.selectRowAtIndexPath(indexPath: indexPaths, animated: true, scrollPosition: UITableViewScrollPosition.None)
  </code>
  Cannot convert the expression's type '(indexPath: [AnyObject]?, animated: BooleanLiteralConvertible, scrollPosition: UITableViewScrollPosition)' to type 'BooleanLiteralConvertible'</p>
  
  <p>Could someone help me out with this one, this is such a headache.</p>
  
  <p>Thank you.</p>