Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Method does not override any method from its superclass swift 3.0 error [duplicate]

I am converting my code from swift 2.2 to swift 3.0 and i got Method does not override any method from its superclass error. Here is my code:

override class func layerClass() -> AnyClass {
        return CAShapeLayer.self
    }

Removing override leads to following error: Method 'layerClass()' with Objective-C selector 'layerClass' conflicts with getter for 'layerClass' from superclass 'UIView' with the same Objective-C selector

like image 380
Kevin Mac Avatar asked Aug 23 '16 13:08

Kevin Mac


1 Answers

layerClass is now a getter and no longer a method (as of Swift 3 or iOS 10). So you have to override the getter:

override public class var layerClass: Swift.AnyClass {
    get {
        return CAShapeLayer.self
    }
}
like image 154
Codo Avatar answered Oct 03 '22 02:10

Codo