<!--
{
  "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/contents",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Core Animation"
    ],
    "preciseIdentifier" : "c:objc(cs)CALayer(py)contents"
  },
  "title" : "contents"
}
-->

# contents

An object that provides the contents of the layer. Animatable.

```
var contents: Any? { get set }
```

## Discussion

The default value of this property is `nil`.

If you are using the layer to display a static image, you can set this property to the <doc://com.apple.documentation/documentation/CoreGraphics/CGImage> containing the image you want to display. (In macOS 10.6 and later, you can also set the property to an <doc://com.apple.documentation/documentation/AppKit/NSImage> object.) Assigning a value to this property causes the layer to use your image rather than create a separate backing store.

If the layer object is tied to a view object, you should avoid setting the contents of this property directly. The interplay between views and layers usually results in the view replacing the contents of this property during a subsequent update.

---

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)