extension UICollectionView { func dequeueCell<T: UICollectionViewCell>(for indexPath: IndexPath) -> T { return dequeueReusableCell(withReuseIdentifier: T.id, for: indexPath) as! T } } extension UITableView { func dequeueCell<T: UITableViewCell>(for indexPath: IndexPath) -> T { return dequeueReusableCell(withIdentifier: T.id, for: indexPath) as! T } func dequeueCell<T: UITableViewCell>() -> T { return dequeueReusableCell(withIdentifier: T.id) as! T } } extension UIStoryboard { func instantiate<T: UIViewController>() -> T { return instantiateViewController(withIdentifier: T.id) as! T } }