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

# CGPatternCallbacks

A structure that holds a version and two callback functions for drawing a custom pattern.

```
struct CGPatternCallbacks
```

## Overview

You supply a [`CGPatternCallbacks`](/documentation/CoreGraphics/CGPatternCallbacks) structure to the function [`init(info:bounds:matrix:xStep:yStep:tiling:isColored:callbacks:)`](/documentation/CoreGraphics/CGPattern/init(info:bounds:matrix:xStep:yStep:tiling:isColored:callbacks:)) to create a data provider for direct access. The functions specified by the [`CGPatternCallbacks`](/documentation/CoreGraphics/CGPatternCallbacks) structure are responsible for drawing the pattern and for handling the pattern’s memory management.

## Topics

### Initializers

[`init()`](/documentation/CoreGraphics/CGPatternCallbacks/init())

[`init(version:drawPattern:releaseInfo:)`](/documentation/CoreGraphics/CGPatternCallbacks/init(version:drawPattern:releaseInfo:))

### Instance Properties

[`drawPattern`](/documentation/CoreGraphics/CGPatternCallbacks/drawPattern)

A pointer to a custom function that draws thepattern. For information about this callback function, see [`CGPatternDrawPatternCallback`](/documentation/CoreGraphics/CGPatternDrawPatternCallback).

[`releaseInfo`](/documentation/CoreGraphics/CGPatternCallbacks/releaseInfo)

An optional pointer to a custom function that’sinvoked when the pattern is released. [`CGPatternReleaseInfoCallback`](/documentation/CoreGraphics/CGPatternReleaseInfoCallback).

[`version`](/documentation/CoreGraphics/CGPatternCallbacks/version)

The version of the structure passed in as a parameterto the [`init(info:bounds:matrix:xStep:yStep:tiling:isColored:callbacks:)`](/documentation/CoreGraphics/CGPattern/init(info:bounds:matrix:xStep:yStep:tiling:isColored:callbacks:)). Forthis version of the structure, you should set this value to zero.



---

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)