Skip to content

Commit

Permalink
Add edit of interval phases
Browse files Browse the repository at this point in the history
  • Loading branch information
deb761 committed Nov 6, 2017
1 parent a8647f3 commit ae52f99
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
19 changes: 10 additions & 9 deletions Trainer/IntervalsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class IntervalsViewController: UITableViewController {
// self.clearsSelectionOnViewWillAppear = false

// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem
self.navigationItem.rightBarButtonItem = self.editButtonItem
}

override func didReceiveMemoryWarning() {
Expand Down Expand Up @@ -102,25 +102,26 @@ class IntervalsViewController: UITableViewController {
}
}

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

/*
// Override to support editing the table view.

// Delete phases from the intervals
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
if editingStyle == .delete {
// Delete the row from the data source
tableView.deleteRows(at: [indexPath], with: .fade)
if let phase = intervals.phases?[indexPath.row] as? Phase {
if DataAccess.delete(phase) {
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
1 change: 0 additions & 1 deletion Trainer/PhasesViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ class PhasesViewController: UITableViewController {
// Delete the row from the data source
if let phase = workout.phases?[indexPath.row] as? Phase {
if DataAccess.delete(phase) {
//tableView.reloadSections(IndexSet([phasesSection]), with: .automatic)
tableView.deleteRows(at: [indexPath], with: .fade)
}
}
Expand Down

0 comments on commit ae52f99

Please sign in to comment.