Nil Error While Running
<p>i am working on TODO app,it was all completed and was running well but suddenly it begins to give an error "fatal error: unexpectedly found nil while unwrapping an Optional value".Need Some Guide!</p>

<pre><code>class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate{


@IBOutlet weak var tableView: UITableView!

var tasks : [Task] = [ ]
override func viewDidLoad() {
    super.viewDidLoad()
    tableView.dataSource = self
    tableView.delegate = self
    // Do any additional setup after loading the view, typically from a nib.
}

override func viewWillAppear(_ animated: Bool) {
    getdata()

    tableView.reloadData() 
}


func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
    return tasks.count
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
    let cell = UITableViewCell()

    let task  = tasks[indexPath.row]

    if task.isimportant{
        cell.textLabel?.text = " ★   \(task.name!)"

    }else{
        cell.textLabel?.text = task.name!
    }

    return cell
}

func getdata() {
    let context =  (UIApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext

    do{
    tasks = try  context.fetch(Task.fetchRequest())
    }
    catch {
        print ("Failed!")
    }
}
</code></pre>

<p>}</p>