A Boolean value indicating whether the view incorporates content from its subviews into its own layer.
- macOS 10.9+
When the value of this property is
true, any subviews that have an implicitly created layer—that is, layers for which you did not explicitly set the
wants property to
true—draw their contents into the current view’s layer. In other words, the subviews do not get a layer of their own. Instead, they draw their content into the parent view’s layer. All views involved in the operation draw their content using their
draw(_:) method. They do not use the
update method to update their layer contents, even if the
wants property is set to
Use this property to flatten the layer hierarchy for a layer-backed view and its subviews. Flattening a layer hierarchy reduces the number of layers (and may reduce the amount of memory) used by your view hierarchy. Reducing the number of layers can be more efficient in situations where there is significant overlap among the subviews or where the content of the view and subviews does not change significantly. For example, flattening a hierarchy reduces the amount of time spent compositing your views together. Do not flatten a view hierarchy if you plan to animate one or more subviews in that hierarchy.
When changing the value of this property, the current view must have a layer object. The default value of this property is