<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.5.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "QuartzCore",
  "identifier" : "/documentation/QuartzCore/CALayer/style",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Core Animation"
    ],
    "preciseIdentifier" : "c:objc(cs)CALayer(py)style"
  },
  "title" : "style"
}
-->

# style

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

```
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:)`](/documentation/QuartzCore/CALayer/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.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)