How do you override layerClass in swift

Solution 1:

Adapted from Apple's ListerKit sample code:

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

Update for Swift 3:

override class var layerClass: AnyClass {
    get {
        return CAGradientLayer.self
    }
}

Solution 2:

In iOS 10, this is a calculated property instead of a method:

override class var layerClass: AnyClass {
    get {
        return CAEAGLLayer.self
    }
}