func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
folderNameArray.remove(at: indexPath.row)
tableView.deleteRows(at: [indexPath], with: UITableView.RowAnimation.automatic)
}
func tableView(_ tableView: UITableView, editingStyleForRowAt indexPath: IndexPath) -> UITableViewCell.EditingStyle {
if tableView.isEditing == true{
return .delete
}else{
return .none
}
}
これでtableViewがisEditingの時でなおかつ
赤い削除マークを押した時だけ削除ができるようになります。