Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Implement layoutAttributesClass() in Swift 3

I am writing a custom Collection View Layout in swift and xcode 8. I tried implementing the custom collection view layout attributes with the following function

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

But I get error 'Method does not override any method from its superclass'. Any help is much appreciated.

like image 342
Nasim Rony Avatar asked Sep 22 '16 12:09

Nasim Rony


1 Answers

You should use var instead of func in Swift 3:

override class var layoutAttributesClass: AnyClass {
    // ...
}
like image 178
pedrouan Avatar answered Oct 25 '22 12:10

pedrouan