Nasim Rony
Nasim Rony

Reputation: 519

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.

Upvotes: 8

Views: 2147

Answers (1)

pedrouan
pedrouan

Reputation: 12910

You should use var instead of func in Swift 3:

override class var layoutAttributesClass: AnyClass {
    // ...
}

Upvotes: 29

Related Questions