If you really want to use the outdated method tableView.dequeueReusableCellWithIdentifier(_:)
you can do it like this:
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier(simpleTableIdentifier) ?? UITableViewCell(style: .Default, reuseIdentifier: simpleTableIdentifier)
cell.textLabel?.text = dwarves[indexPath.row]
return cell
}
But you should preferably use dequeueReusableCellWithIdentifier(_:forIndexPath:)
which never returns nil
.
It is used along with registerClass(_:forCellReuseIdentifier:)
and registerNib(_:forCellReuseIdentifier:)
.