---
title: CGPatternRetain
framework: coregraphics
role: symbol
role_heading: Function
path: coregraphics/cgpatternretain
---

# CGPatternRetain

Increments the retain count of a Core Graphics pattern.

## Declaration

```occ
extern CGPatternRefCGPatternRetain(CGPatternRef pattern);
```

## Parameters

- `pattern`: The pattern to retain.

## Return Value

Return Value The same pattern youpassed in as the pattern parameter.

## Discussion

Discussion This function is equivalent to CFRetain,except that it does not cause an error if the pattern parameteris NULL.

## See Also

### Retaining and Releasing a Pattern

- [CGPatternRelease](coregraphics/cgpatternrelease.md)
