I\'d like a UITableView
with subtitle
-style cells that use dequeueReusableCellWithIdentifier
.
My original Objective-C code was
You can use a slightly different syntax than the one from memmons to prevent the forced unwrapping:
let cell = tableView.dequeueReusableCellWithIdentifier(reuseIdentifier) as? UITableViewCell ?? UITableViewCell(style: .Subtitle,
reuseIdentifier: reuseIdentifier)
cell.detailTextLabel?.text = "some text"
return cell
This is using XCode 6.1 7, Swift 1.2 2.0 syntax where UITableView
is no longer an optional.