title: Delete button in UITableView (SWIFT)
body: <p>I have a piece of code here, which seems to be working just fine apart from one little piece. </p>
  
  <pre><code>import UIKit
  
  class FirstViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
      @IBOutlet var tblTasks: UITableView!
  
      //Returning to view
      override func viewWillAppear(animated: Bool) {
          tblTasks.reloadData();
      }
  
      //UItableViewDataSource
      func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int{
          return taskMgr.tasks.count
      }
  
      func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -&gt; Bool {
          return true
      }
  
      func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
          if (editingStyle == UITableViewCellEditingStyle.Delete) {
              // handle delete (by removing the data from your array and updating the tableview)
          }
      }
  
      func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell{        
          let cell: UITableViewCell = UITableViewCell(style: UITableViewCellStyle.Subtitle, reuseIdentifier: "test")
          cell.textLabel?.text = taskMgr.tasks[indexPath.row].name
          cell.detailTextLabel?.text = taskMgr.tasks[indexPath.row].desc
          return cell
       }
  }
  </code></pre>
  
  <p>I have introduced these lines in order to be able to delete rows in the table view</p>
  
  <pre><code>func tableView(tableView: UITableView, 
                 canEditRowAtIndexPath indexPath: NSIndexPath) -&gt; Bool {
      return true
  }
  
  func tableView(tableView: UITableView, 
                 commitEditingStyle editingStyle: UITableViewCellEditingStyle, 
                 forRowAtIndexPath indexPath: NSIndexPath) {
      if (editingStyle == UITableViewCellEditingStyle.Delete) {
          // handle delete (by removing the data from your array and updating the tableview)            
      }
  }
  </code></pre>
  
  <p>and what they do is giving me the possibility to swipe rows from right to left, though the row doesn't get deleted. </p>
  
  <p>What would be the best possible way to introduce a DELETE button in this case? </p>
  
  <p>best regards, Vlad </p>