Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

**Redundant conformance of 'FlickrPhotosViewController' to protocol 'UICollectionViewDataSource'** [duplicate]

Tags:

xcode

swift

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.

like image 694
di477 Avatar asked Dec 15 '22 10:12

di477


1 Answers

"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.

like image 97
jtbandes Avatar answered Jan 05 '23 00:01

jtbandes