8

I have update my Project to Swift3 in Xcode 8 and it comes this error but I have no idea what I can make there. I have already search in google but nothing founded. Have anyone an Idea what I can make ?

Here the Error:

Method 'collectionViewContentSize()' with Objective-C selector 'collectionViewContentSize' conflicts with getter for 'collectionViewContentSize' from superclass 'UICollectionViewLayout' with the same Objective-C selector

  public func collectionViewContentSize() -> CGSize {
        let numberOfSections = collectionView?.numberOfSections
        if numberOfSections == 0 {
            return CGSize.zero
        }

        var contentSize = collectionView?.bounds.size
        contentSize?.height = CGFloat(columnHeights[0])

        return contentSize!
    }
Marshall
  • 85
  • 1
  • 5

1 Answers1

41

I had something similar but I was overriding collectionViewContentSize()

override func collectionViewContentSize() -> CGSize {
    let collection = collectionView!
    let width = collection.bounds.size.width
    let height = max(posYColumn1, posYColumn2)

    return CGSize(width: width, height: height)
}

I Downloaded XCode 8 beta 4 today and have had to change it to:

override var collectionViewContentSize: CGSize {
    let collection = collectionView!
    let width = collection.bounds.size.width
    let height = max(posYColumn1, posYColumn2)

    return CGSize(width: width, height: height)
}
Magnas
  • 3,507
  • 4
  • 27
  • 40