Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mitulmanish/fbcb4826b43f540efe4e418eb0136fe1 to your computer and use it in GitHub Desktop.
Save mitulmanish/fbcb4826b43f540efe4e418eb0136fe1 to your computer and use it in GitHub Desktop.
class DashboardCollectionViewController: UICollectionViewController {
override func viewDidLoad() {
collectionView?.register(DashboardCollectionViewCell.self, forCellWithReuseIdentifier: DashboardCollectionViewCell.cellIdentifier)
}
override func numberOfSections(in collectionView: UICollectionView) -> Int {
return 1
}
override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
guard let dashboardCell = collectionView.dequeueReusableCell(withReuseIdentifier: DashboardCollectionViewCell.cellIdentifier, for: indexPath) as? DashboardCollectionViewCell else { fatalError("cell cannot be dequeued") }
return dashboardCell
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment