Skip to content

Latest commit

 

History

History
29 lines (17 loc) · 536 Bytes

table-view-cell-identifier.md

File metadata and controls

29 lines (17 loc) · 536 Bytes

Table view cell identifiers should be inferred from the class name

Rationale

TODO

Example

protocol IdentifiableCell {
    
  static var cellIdentifier: String { get }
    
}

extension UITableViewCell: IdentifiableCell {
    
  static var cellIdentifier: String { return String(self) }
    
}

extension UITableView {
    
  func registerCell(cellType: IdentifiableCell.Type) {
    registerNib(UINib(nibName: cellType.cellIdentifier, bundle: nil), forCellReuseIdentifier: cellType.cellIdentifier)
  }
    
}