Skip to content

Commit

Permalink
Add delete functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
DipanshKhandelwal committed Oct 20, 2019
1 parent c5b68a5 commit 258d6c3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions food-tracker-app/MealTableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ class MealTableViewController: UITableViewController {
override func viewDidLoad() {
super.viewDidLoad()

// Use the edit button item provided by the table view controller.
navigationItem.leftBarButtonItem = editButtonItem

// Load the sample data.
loadSampleMeals()
}
Expand Down Expand Up @@ -51,25 +54,22 @@ class MealTableViewController: UITableViewController {
return cell
}

/*
// Override to support conditional editing of the table view.
override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
// Return false if you do not want the specified item to be editable.
return true
}
*/

/*
// Override to support editing the table view.
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
if editingStyle == .delete {
// Delete the row from the data source
meals.remove(at: indexPath.row)
tableView.deleteRows(at: [indexPath], with: .fade)
} else if editingStyle == .insert {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}
*/

/*
// Override to support rearranging the table view.
Expand Down

0 comments on commit 258d6c3

Please sign in to comment.