Skip to content

Instantly share code, notes, and snippets.

@bmoliveira
Last active May 10, 2016 10:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bmoliveira/2a1a1084c68ec0860005 to your computer and use it in GitHub Desktop.
Save bmoliveira/2a1a1084c68ec0860005 to your computer and use it in GitHub Desktop.
ExampleCell + ExampleViewController
class ExampleCell: UICollectionViewCell, ReusableCell {
func updateCellUI() {
print("Here you should do something")
}
}
class ExampleViewController: UIViewController {
@IBOutlet weak var collectionView: UICollectionView!
override func viewDidLoad() {
collectionView.registerCell(ExampleCell)
}
}
extension ExampleViewController: UICollectionViewDataSource {
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let cell: ExampleCell = collectionView.dequeueReusableCell(indexPath)
cell.updateCellUI()
return cell
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment