title: Deleting a Row from a UITableView in Swift?
body: <p>I have a table of names and I am making a swipe and delete function for them which removes them from a names variable which is an array.</p>
  <p>I selected the functions which most closely resembled the tutorial inside xcode and filled them out, but my app crashes randomly when I click the delete button. Here is my code for the delete button:</p>
  <pre><code>func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -&gt; [UITableViewRowAction]? {
      let deleteAction = UITableViewRowAction(style: .destructive, title: &quot;Delete&quot;) { (rowAction: UITableViewRowAction, indexPath: IndexPath) -&gt; Void in
          print(&quot;Deleted&quot;)
          self.catNames.remove(at: indexPath.row)
          self.tableView.deleteRows(at: [indexPath], with: UITableViewRowAnimation.automatic)
          self.tableView.reloadData()
      }
  }
  </code></pre>
  <p>I'm new to coding and learning swift, I am following a tutorial for swift 2 and working with swift 3 so there are a few issues I have when following along, this being one I'm properly stuck on.</p>