<!--
{
  "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/CGDataConsumer/init(info:cbks:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Core Graphics",
      "CoreGraphics"
    ],
    "preciseIdentifier" : "c:@F@CGDataConsumerCreate"
  },
  "title" : "init(info:cbks:)"
}
-->

# init(info:cbks:)

Creates a data consumer that uses callback functions to write data.

```
init?(info: UnsafeMutableRawPointer?, cbks: UnsafePointer<CGDataConsumerCallbacks>)
```

## Parameters

`info`

A pointer to data of any type or `NULL`. When the callback is called, Core Graphics passes this pointer as the `info` parameter.

`cbks`

A pointer to a structure that specifies the callback functions you implement to copy data sent to the consumer and to handle the consumer’s basic memory management. For a complete description, see [`CGDataConsumerCallbacks`](/documentation/CoreGraphics/CGDataConsumerCallbacks).

## Return Value

A new data consumer object. In Objective-C, you’re responsible for releasing this object using [`CGDataConsumerRelease`](/documentation/CoreGraphics/CGDataConsumerRelease).

## Discussion

---

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)