<!--
{
  "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/CGDataProvider/init(dataInfo:data:size:releaseData:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Core Graphics",
      "CoreGraphics"
    ],
    "preciseIdentifier" : "c:@F@CGDataProviderCreateWithData"
  },
  "title" : "init(dataInfo:data:size:releaseData:)"
}
-->

# init(dataInfo:data:size:releaseData:)

Creates a direct-access data provider that uses data your program supplies.

```
init?(dataInfo info: UnsafeMutableRawPointer?, data: UnsafeRawPointer, size: Int, releaseData: CGDataProviderReleaseDataCallback)
```

## Parameters

`info`

A pointer to data of any type, or `NULL`. When Core Graphics calls the function specified in the `releaseData` parameter, it sends this pointer as its first argument.

`data`

A pointer to the array of data that the provider contains.

`size`

A value that specifies the number of bytes that the data provider contains.

`releaseData`

A pointer to a release callback for the data provider, or `NULL`. Your release function is called when Core Graphics frees the data provider. For more information, see [`CGDataProviderReleaseDataCallback`](/documentation/CoreGraphics/CGDataProviderReleaseDataCallback).

## Return Value

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

## Discussion

You use this function to create a direct-access data provider that uses callback functions to read data from your program an entire block at one time.

---

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)