Lory Huz Lory Huz - 1 year ago 137
iOS Question

XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass

I encounter some issues on collectionView & collectionViewLayout on Xcode 8 + Swift 3 project.

It's seems some methods totally disappeared.

For example, when I subclass UICollectionViewFlowLayout:

override func layoutAttributesClass() -> AnyClass

This trigger xcode error:

Method does not override Any Method from his superclass

Documentation of this method:

Not sure it's Xcode 8 related because I already have strange issues with collectionView on Xcode 7 and swift 2.3, for example, itemSizeAtIndexPath method is not detected on xcode but if I put the method in a collectionViewController it's called even without the keyword override.

Answer Source

In Swift 3, it is a (class) property instead of a method:

override class var layoutAttributesClass: AnyClass {
    // ...
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download