Last active
May 15, 2017 23:05
-
-
Save Iron-Ham/60cb138440c551f32a884b979f04e26b to your computer and use it in GitHub Desktop.
A better way!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Instantiating view controllers from a storybaord | |
let myStoryboard: UIStoryboard = ... | |
let myCustomViewController: MyCustomViewController = myStoryboard.instantiateViewControllerOfType(MyCustomViewController.self) | |
// Registration of a UITableViewCell | |
tableView.register(MyCustomCellType.self) | |
// Dequeueing of a UITableViewCell | |
let cell = tableView.dequeueReusableCell(for: indexPath) as MyCustomCellType | |
// Registration of a UICollectionViewCell | |
collectionView.register(MyCustomCellType.self) | |
// Dequeueing of a UICollectionViewCell | |
let cell = collectionView.dequeueReusableCell(for: indexPath) as MyCustomCellType | |
// Registration of a UITableViewHeaderFooterView | |
tableView.register(MyCustomHeaderFooterView.self) | |
/// Dequeueing of a UITableViewHeaderFooterView | |
let header = tableView.dequeueReusableHeaderFooterView(inSection: section) as MyCustomHeaderFooterView | |
// Registration UICollectionView Supplementary View | |
collectionView.register(MyCustomSupplementaryView.self, forSupplementaryViewElementOfKind: .sectionHeader) // or .sectionFooter | |
// Dequeueing UICollectionView Supplementary View | |
let view = collectionView.dequeueReusableSupplementaryView(ofKind: .sectionHeader, for: indexPath) as MyCustomSupplementaryView // also takes .sectionFooter |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment