Embed layoutAttributesClass () in Swift 3

I am writing a custom layout for collections view in swift and xcode 8. I tried to implement the layout attributes of custom collections with the following function

override class func layoutAttributesClass() -> AnyClass { return CircularCollectionViewLayoutAttributes.self } 

But I get the error "The method does not cancel any method from its superclass." Any help is greatly appreciated.

+6
source share
1 answer

You should use var instead of func in Swift 3 :

 override class var layoutAttributesClass: AnyClass { // ... } 
+22
source

All Articles