chunkyguy chunkyguy - 2 months ago 26
Swift Question

How do you override layerClass in swift

In Objective-C we use to do it like this

+ (Class)layerClass
{
return [CAEAGLLayer class];
}


Obviously this won't work:

CAEAGLLayer.class()


Because
class
is a keyword in Swift. How do you do it in Swift?

Answer

Adapted from Apple's ListerKit sample code:

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