ios - Creating a UITableView object crashes in Swift -


i making to-do app in swift, , trying display tasks using uitableview. users add task, , press "done". uitableview brought front, , app crashes. here code:

override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell {      let cell: uitableviewcell = uitableviewcell(style: uitableviewcellstyle.subtitle, reuseidentifier: nil) //crashes on line     cell.textlabel!.text = taskmgr.tasksarray[indexpath.row].name     cell.detailtextlabel!.text = taskmgr.tasksarray[indexpath.row].desc      return cell } 

funny enough, line works fine in similar app created. please point me in right direction? happy add more detail if necessary.

use reuse identifier

func tableview(tableview: uitableview!, cellforrowatindexpath indexpath: nsindexpath!) -> uitableviewcell! {     var cell:uitableviewcell = self.tblswift.dequeuereusablecellwithidentifier("cell") uitableviewcell      cell.textlabel.text = self.items[indexpath.row]     return cell } 

with detail title

func tableview(tableview: uitableview!, cellforrowatindexpath indexpath: nsindexpath!) -> uitableviewcell! {      var cell = tableview.dequeuereusablecellwithidentifier("cell") as? uitableviewcell      if cell == nil {         cell = uitableviewcell(style: .subtitle, reuseidentifier: "cell")     }     cell!.textlabel.text = self.names[indexpath.row]     cell!.detailtextlabel.text = self.emails[indexpath.row]     return cell } 

Comments