Last active
May 10, 2016 10:36
-
-
Save bmoliveira/2a1a1084c68ec0860005 to your computer and use it in GitHub Desktop.
ExampleCell + ExampleViewController
This file contains 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
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