How do you override layerClass in swift

后端 未结 4 1778
醉话见心
醉话见心 2021-02-04 23:45

In Objective-C we use to do it like this

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

Obviously this won\'t work:

CA         


        
4条回答
  •  余生分开走
    2021-02-05 00:28

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

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

提交回复
热议问题