Slide 17
Slide 17 text
extension EntryCellRepresentable {
func registerEntryCell() {
let ids = ["EntryCell", "EntryCellWithImage"]
ids.forEach {
let nib = UINib(nibName: $0, bundle: nil)
tableView.registerNib(nib,
forCellReuseIdentifier: $0)
}
}
func dequeueEntryCell(entry: Entry, forIndexPath
indexPath: NSIndexPath) -> EntryCell {
let id = entry.hasImage ? "EntryCellWithImage"
: "EntryCell"
let cell =
tableView.dequeueReusableCellWithIdentifier(id,
forIndexPath: indexPath) as! EntryCell
cell.entry = entry
return cell
}
}