Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extension UITableView {
- public func dequeue<T: UITableViewCell>(cellClass: T.Type) -> T? {
- return dequeueReusableCell(withIdentifier: cellClass.reuseIdentifier) as? T
- }
- public func dequeue<T: UITableViewCell>(cellClass: T.Type, forIndexPath indexPath: IndexPath) -> T {
- guard let cell = dequeueReusableCell(
- withIdentifier: cellClass.reuseIdentifier, for: indexPath) as? T else {
- fatalError(
- "Error: cell with id: \(cellClass.reuseIdentifier) for indexPath: \(indexPath) is not \(T.self)")
- }
- return cell
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement