SHARE
TWEET

Untitled

a guest Apr 21st, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. extension UITableView {
  2.    
  3.     public func dequeue<T: UITableViewCell>(cellClass: T.Type) -> T? {
  4.         return dequeueReusableCell(withIdentifier: cellClass.reuseIdentifier) as? T
  5.     }
  6.  
  7.     public func dequeue<T: UITableViewCell>(cellClass: T.Type, forIndexPath indexPath: IndexPath) -> T {
  8.         guard let cell = dequeueReusableCell(
  9.             withIdentifier: cellClass.reuseIdentifier, for: indexPath) as? T else {
  10.                 fatalError(
  11.                     "Error: cell with id: \(cellClass.reuseIdentifier) for indexPath: \(indexPath) is not \(T.self)")
  12.         }
  13.         return cell
  14.     }
  15.    
  16. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top