Skip to content

Instantly share code, notes, and snippets.

@armstrongnate
Created December 11, 2015 23:22
Show Gist options
  • Save armstrongnate/548df082824987fd2196 to your computer and use it in GitHub Desktop.
Save armstrongnate/548df082824987fd2196 to your computer and use it in GitHub Desktop.
tableView:cellForRowAtIndexPath using UITableViewCell class with preset style
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