<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreGraphics",
  "identifier" : "/documentation/CoreGraphics/CGLayer",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Core Graphics"
    ],
    "preciseIdentifier" : "c:@T@CGLayerRef"
  },
  "title" : "CGLayer"
}
-->

# CGLayer

An offscreen context for reusing content drawn with Core Graphics.

```
class CGLayer
```

## Topics

### Creating Layer Objects

[`init(_:size:auxiliaryInfo:)`](/documentation/CoreGraphics/CGLayer/init(_:size:auxiliaryInfo:))

Creates a layer object that is associated with a graphics context.

### Retaining and Releasing Color Objects

[`CGLayerRetain`](/documentation/CoreGraphics/CGLayerRetain)

Increments the retain count of a layer object.

[`CGLayerRelease`](/documentation/CoreGraphics/CGLayerRelease)

Decrements the retain count of a layer object.

### Examining a Layer

[`context`](/documentation/CoreGraphics/CGLayer/context)

Returns the graphics context associated with a layer object.

[`size`](/documentation/CoreGraphics/CGLayer/size)

Returns the width and height of a layer object.

### Working with Core Foundation Types

[`typeID`](/documentation/CoreGraphics/CGLayer/typeID)

Returns the unique type identifier used for [`CGLayer`](/documentation/CoreGraphics/CGLayer) objects.



---

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)