 
     override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
         // #warning Incomplete implementation, return the number of rows
-        return tasksToDisplay.count
+        return tasks.count
     }
     
     override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
+        let task = tasks[indexPath.row]
         let cell = UITableViewCell(style: .subtitle, reuseIdentifier: "taskCell")
-        cell.textLabel?.text = tasksToDisplay[indexPath.row].name
+        cell.textLabel?.text = task.name
         let outputFormatter = DateFormatter()
         outputFormatter.dateStyle = .full
-        cell.detailTextLabel?.text = outputFormatter.string(from: tasksToDisplay[indexPath.row].dueDate!)
+        cell.detailTextLabel?.text = outputFormatter.string(from: task.dueDate!)
+        if task.completed == true {
+            cell.accessoryType = .checkmark
+        }
         return cell
     }
     


import UIKit

class TaskVC: UITableViewController, AddTaskDelegate, UIPopoverPresentationControllerDelegate {
    
    var classes: [JHSchoolClass]!
    var clas: JHSchoolClass!
    var tasksToDisplay: [JHTask]!
    
    override func viewDidLoad() {
        super.viewDidLoad()

        title = clas.name
        
        setUp()
        
    }

    func reloadTasks() {
        //Reloads and saves tasks
        saveClasses()
        loadTasks()
        tableView.reloadData()
    }
    
