Contents

wantsUpdateLayer

A Boolean value indicating which drawing path the view takes when updating its contents.

Declaration

var wantsUpdateLayer: Bool { get }

Discussion

A view can update its contents using one of two techniques. It can draw those contents using its draw(_:) method or it can modify its underlying layer object directly. During the view update cycle, each dirty view calls this method on itself to determine which technique to use. The default implementation of this method returns false, which causes the view to use its draw(_:) method.

If your view is layer-backed and updates itself by modifying its layer, override this property and change the return value to true. Modifying the layer is significantly faster than redrawing the layer contents using draw(_:). If you override this property to be true, you must also override the updateLayer() method of your view and use it to make the changes to your layer. Do not modify your layer in your implementation of this property. Your implementation should return true or false quickly and not perform other tasks.

If the canDrawSubviewsIntoLayer property is set to true, the view ignores the value returned by this method. Instead, the view always uses its draw(_:) method to draw its content.

See Also

Related Documentation

Managing the View’s Layer