Contents

layerClass

Returns the class used to create the layer for instances of this class.

Declaration

class var layerClass: AnyClass { get }

Return Value

The class used to create the view’s Core Animation layer.

Discussion

This method returns the CALayer class object by default. Subclasses can override this method and return a different layer class as needed. For example, if your view uses tiling to display a large scrollable area, you might want to override this property and return the CATiledLayer class, as shown in the following code.

override class var layerClass : AnyClass {
   return CATiledLayer.self
}

This method is called only once early in the creation of the view in order to create the corresponding layer object.

See Also

Configuring a view’s visual appearance