Created
December 11, 2015 23:22
-
-
Save armstrongnate/548df082824987fd2196 to your computer and use it in GitHub Desktop.
tableView:cellForRowAtIndexPath using UITableViewCell class with preset style
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { | |
var cell: UITableViewCell? | |
cell = tableView.dequeueReusableCellWithIdentifier(UITableViewCell.wta_reuseableIdentifier()) | |
if cell == nil { | |
cell = UITableViewCell(style: .Value1, reuseIdentifier: UITableViewCell.wta_reuseableIdentifier()) | |
} | |
if let result = viewModel?.results.value[indexPath.row] { | |
cell!.textLabel!.text = result.name | |
cell!.detailTextLabel!.text = result.phone | |
} | |
return cell! | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment