<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.0.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreGraphics",
  "identifier" : "/documentation/CoreGraphics/CGPatternRetain",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Graphics"
    ],
    "preciseIdentifier" : "c:@F@CGPatternRetain"
  },
  "title" : "CGPatternRetain"
}
-->

# CGPatternRetain

Increments the retain count of a Core Graphics pattern.

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

## Parameters

`pattern`

The pattern to retain.

## Return Value

The same pattern youpassed in as the `pattern` parameter.

## Discussion

This function is equivalent to <doc://com.apple.documentation/documentation/CoreFoundation/CFRetain>,except that it does not cause an error if the `pattern` parameteris `NULL`.

---

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)