Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions Sources/View/UITableView+Reusable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,29 @@ public extension UITableView {
}
return cell
}


/**
Returns a reusable `UITableViewCell` object for the class inferred by the return-type

- parameter cellType: The cell class to dequeue
- returns: A `Reusable`, `UITableViewCell` instance

- note: It's the old way to dequeueCell and it's used when you insert cell at the end of tableview.
- seealso: `dequeueReusableCell(withIdentifier:)`
*/
final func dequeueReusableCell<T: UITableViewCell>(cellType: T.Type = T.self) -> T where T: Reusable {
guard let cell = self.dequeueReusableCell(withIdentifier: cellType.reuseIdentifier) as? T else {
fatalError(
"Failed to dequeue a cell with identifier \(cellType.reuseIdentifier) matching type \(cellType.self). "
+ "Check that the reuseIdentifier is set properly in your XIB/Storyboard "
+ "and that you registered the cell beforehand"
)
}
return cell
}



/**
Register a NIB-Based `UITableViewHeaderFooterView` subclass (conforming to `NibReusable`)
Expand Down