Swift3 中的 func collectionViewContentSize

func collectionViewContentSize in Swift3

我已经在 Xcode 8 中将我的项目更新为 Swift3,但它出现了这个错误,但我不知道我能在那里做什么。我已经在 google 中搜索过,但没有任何依据。 有人知道我能做什么吗?

这里是错误:

带有 Objective-C 选择器 'collectionViewContentSize' 的方法 'collectionViewContentSize()' 与具有相同 Objective-C 的超类 'UICollectionViewLayout' 的 'collectionViewContentSize' 的 getter 冲突]选择器

  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!
    }

我有类似的东西,但我覆盖了 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)
}

我今天下载了 XCode 8 beta 4,不得不将其更改为:

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

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