3

I am following this (http://www.raywenderlich.com/78550/beginning-ios-collection-views-swift-part-1) tutorial, and now i am

getting this error :

Redundant conformance of 'FlickrPhotosViewController' to protocol 'UICollectionViewDataSource'

So i have this code over here :

extension FlickrPhotosViewController : UICollectionViewDataSource {

//1
override func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
    return searches.count
}

//2
override func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
    return searches[section].searchResults.count
}

//3
override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
    let cell = collectionView.dequeueReusableCellWithReuseIdentifier(reuseIdentifier, forIndexPath: indexPath)
    cell.backgroundColor = UIColor.blackColor()
    // Configure the cell
    return cell

So what does this error mean?

any help would be appreciated.

Muhammad Asyraf
  • 1,748
  • 15
  • 20
di477
  • 57
  • 1
  • 9

1 Answers1

12

"Redundant conformance" means that you are specifying extension FlickrPhotosViewController : UICollectionViewDataSource, but this isn't necessary because FlickrPhotosViewController's superclass already provides a UICollectionViewDataSource conformance.

You can just use extension FlickrPhotosViewController instead.

jtbandes
  • 115,675
  • 35
  • 233
  • 266