Updates the view’s content by modifying its underlying layer.
- macOS 10.8+
You use this method to optimize the rendering of your view in situations where you can represent your views contents entirely using a layer object. If your view’s
wants property is
true, the view calls this method instead of
draw(_:) during the view update cycle. Custom views can override this method and use it to modify the properties of the underlying layer object. Modifying layer properties is a much more efficient way to update your view than is redrawing its content each time something changes.
When you want to update the contents of your layer, mark the view as dirty by setting its
needs property to
true. Doing so adds the view to the list of views that need to be refreshed during the next update cycle. During that update cycle, this method is called if the
wants property is still
Your implementation of this method should not call