Contents

style

An optional dictionary used to store property values that aren’t explicitly defined by the layer.

Declaration

var style: [AnyHashable : Any]? { get set }

Discussion

This dictionary may in turn have a style key, forming a hierarchy of default values. In the case of hierarchical style dictionaries the shallowest value for a property is used. For example, the value for “style.someValue” takes precedence over “style.style.someValue”.

If the style dictionary does not define a value for an attribute, the receiver’s defaultValue(forKey:) method is called. The default value of this property is nil.

The style dictionary is not consulted for the following keys: bounds, frame.

See Also

Modifying the layer’s appearance