Hi, I'm in the process of creating a collection view but for some reason its not compiling.
Code**
class ExploreViewController: UIViewController,UICollectionViewDataSource,UICollectionViewDelegate {
@IBOutlet var collectionView: UICollectionView!
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { // cells to display
return 20
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { //what to display in cells
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "exploreCell", for: indexPath)
return cell
}
func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath)-> UICollectionReusableView {
let headerView = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "header", for: indexPath)
return headerView
}
}
Error message
020-06-27 03:02:34.920871-0400 Resturant Finder[20891:1044378] -[UIView collectionView:numberOfItemsInSection:]: unrecognized selector sent to instance 0x7fc3e6f15350
2020-06-27 03:02:34.927980-0400 Resturant Finder[20891:1044378] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView collectionView:numberOfItemsInSection:]: unrecognized selector sent to instance 0x7fc3e6f15350'
***** First throw call stack:**