A Boolean value that determines whether the view’s bounds should be automatically cleared before drawing.
- iOS 2.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
When set to
true, the drawing buffer is automatically cleared to transparent black before the
draw(_:) method is called. This behavior ensures that there are no visual artifacts left over when the view’s contents are redrawn. If the view’s
is property is also set to
background property of the view must not be
nil or drawing errors may occur. The default value of this property is
If you set the value of this property to
false, you are responsible for ensuring the contents of the view are drawn properly in your
draw(_:) method. If your drawing code is already heavily optimized, setting this property is
false can improve performance, especially during scrolling when only a portion of the view might need to be redrawn.