 
 import UIKit
 
-class TaskVC: UITableViewController, AddTaskDelegate, UIPopoverPresentationControllerDelegate {
+enum TaskViewType {
+    case NotCompleted
+    case All
+}
+
+class TaskVC: UITableViewController, AddTaskDelegate, UIPopoverPresentationControllerDelegate, UIGestureRecognizerDelegate {
     
     var classes: [JHSchoolClass]!
     var clas: JHSchoolClass!
-    var tasksToDisplay: [JHTask]!
+    var incompletedTasks: [JHTask]!
+    var displayType: TaskViewType = .NotCompleted
+    var tasks: [JHTask]!
     
     override func viewDidLoad() {
         super.viewDidLoad()
-
+        
         title = clas.name
-        
         setUp()
         
     }

    
    override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        tableView.deselectRow(at: indexPath, animated: true)
        let task = tasksToDisplay[indexPath.row]
        task.completed = !task.completed
        let cell = tableView.cellForRow(at: indexPath)
        if cell?.accessoryType == UITableViewCellAccessoryType.none {


    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        // #warning Incomplete implementation, return the number of rows
        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 = task.name
        let outputFormatter = DateFormatter()
        outputFormatter.dateStyle = .full
        cell.detailTextLabel?.text = outputFormatter.string(from: task.dueDate!)
        if task.completed == true {
            cell.accessoryType = .checkmark
        }
        return cell
    }
    
