---
title: CGLayerRetain
framework: coregraphics
role: symbol
role_heading: Function
path: coregraphics/cglayerretain
---

# CGLayerRetain

Increments the retain count of a layer object.

## Declaration

```occ
extern CGLayerRefCGLayerRetain(CGLayerRef layer);
```

## Parameters

- `layer`: The layer to retain.

## Return Value

Return Value The same layer you passed in as the layer parameter.

## Discussion

Discussion This function is equivalent to calling CFRetain except that it does not crash if the layer parameter is null.

## See Also

### Retaining and Releasing Color Objects

- [CGLayerRelease](coregraphics/cglayerrelease.md)
