---
title: style
framework: quartzcore
role: symbol
role_heading: Instance Property
path: quartzcore/calayer/style
---

# style

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

## Declaration

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

## Discussion

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. warning: If the style dictionary or any of its ancestors are modified, the values of the layer’s properties are undefined until the style property is reset.

## See Also

### Modifying the layer’s appearance

- [contentsGravity](quartzcore/calayer/contentsgravity.md)
- [Contents Gravity Values](quartzcore/contents-gravity-values.md)
- [opacity](quartzcore/calayer/opacity.md)
- [isHidden](quartzcore/calayer/ishidden.md)
- [masksToBounds](quartzcore/calayer/maskstobounds.md)
- [mask](quartzcore/calayer/mask.md)
- [isDoubleSided](quartzcore/calayer/isdoublesided.md)
- [cornerRadius](quartzcore/calayer/cornerradius.md)
- [maskedCorners](quartzcore/calayer/maskedcorners.md)
- [CACornerMask](quartzcore/cacornermask.md)
- [borderWidth](quartzcore/calayer/borderwidth.md)
- [borderColor](quartzcore/calayer/bordercolor.md)
- [backgroundColor](quartzcore/calayer/backgroundcolor.md)
- [shadowOpacity](quartzcore/calayer/shadowopacity.md)
- [shadowRadius](quartzcore/calayer/shadowradius.md)
