title: Swift: Delay in UITableViewCell Selection
body: <p>I have a UITableView inside of another view.  Whenever I click on a cell in the table, I would like that cell to be highlighted until it is clicked again to deselect it.  Using the didSelectRowAtIndexPath method, I have accomplished this.  However, the cell selection takes a long time.  I have to hold down on a cell for 3 seconds before it highlights the cell, rather than it being instantaneous.  How do I get it to select the cell the instant it is touched?</p>
  
  <p>Here is my relevant code.</p>
  
  <pre><code>class AddDataViewController : UIViewController {
  
      @IBOutlet weak var locationTableView: UITableView!  
  
      var fstViewController : FirstViewController?
  
      let locationTableViewController = LocationTableViewController()
  
      override func viewWillAppear(animated: Bool) {
          // Set the data source and delgate for the tables
          self.locationTableView.delegate = self.locationTableViewController
          self.locationTableView.dataSource = self.locationTableViewController
  
          // Set the cell separator style of the tables to none
          self.locationTableView.separatorStyle = UITableViewCellSeparatorStyle.None
  
          // Refresh the table
          self.locationTableView.reloadData()
      }
  
      override func viewDidLoad(){
          super.viewDidLoad()
  
          // Create a tap gesture recognizer for dismissing the keyboard
          let tapRecognizer = UITapGestureRecognizer()
  
          // Set the action of the tap gesture recognizer
          tapRecognizer.addTarget(self, action: "dismissKeyboard")
  
          // Add the tap gesture recognizer to the view
          //self.view.addGestureRecognizer(tapRecognizer)
      }
  }
  
  class LocationTableViewController : UITableViewController, UITableViewDelegate, UITableViewDataSource {
  
      override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
          return 10
      }
  
      override func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -&gt; CGFloat {
          return tableView.frame.height / 5
      }
  
      override func tableView(tableView: UITableView, shouldHighlightRowAtIndexPath indexPath: NSIndexPath) -&gt; Bool {
          return true
      }
  
      override func tableView(tableView: UITableView, didHighlightRowAtIndexPath indexPath: NSIndexPath) {
          tableView.cellForRowAtIndexPath(indexPath)?.backgroundColor = UIColor.greenColor()
      }
  
      override func tableView(tableView: UITableView, didUnhighlightRowAtIndexPath indexPath: NSIndexPath) {
          tableView.cellForRowAtIndexPath(indexPath)?.backgroundColor = UIColor.whiteColor()
      }
  
      override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
          tableView.cellForRowAtIndexPath(indexPath)?.backgroundColor = UIColor.blueColor()
      }
  
      override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell {
  
          let cell = UITableViewCell(style: UITableViewCellStyle.Value2, reuseIdentifier: "addDataCell")
  
          cell.selectionStyle = UITableViewCellSelectionStyle.None
  
          cell.textLabel!.text = "Test"
  
          return cell
      }
  }
  </code></pre>