CellRegistrable is a library that adds a simple way to register your cells to UITableView and UICollectionView.
pod 'CellRegistrable', '~> 1.0'import CellRegistrable
override func viewDidLoad() {
super.viewDidLoad()
tableView.registerCell(ExampleTableViewCell)
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier(
ExampleTableViewCell.reuseIdentifier,
forIndexPath: indexPath)
// Configure your cell
return cell
}NOTE: This library has a default implementation that uses the name of the cell class for the reuseIdentifier and assumes the nib name is the same as the reuseIdentifier, in case your nib name is different you can either return the name of your nib in the reuseIdentifier variable or return your nib implementing the nib variable in your cell.
CellRegistrable is available under the MIT license. See the LICENSE file for more info.