---
title: data
framework: coregraphics
role: symbol
role_heading: Instance Property
path: coregraphics/cgcontext/data
---

# data

Returns a pointer to the image data associated with a bitmap context.

## Declaration

```swift
var data: UnsafeMutableRawPointer? { get }
```

## Discussion

Discussion If you provided the memory for the bitmap data, you can use this method to get that data pointer. If you passed NULL for the data pointer when creating your bitmap context, it is safe to get the data pointer in iOS 4.0 and later and macOS 10.6 and later only. In earlier versions of the operating system, passing NULL for the data parameter is not supported and may lead to crashes when attempting to access this data using this function.

## See Also

### Managing a Bitmap Graphics Context

- [bitmapInfo](coregraphics/cgcontext/bitmapinfo.md)
- [alphaInfo](coregraphics/cgcontext/alphainfo.md)
- [bitsPerComponent](coregraphics/cgcontext/bitspercomponent.md)
- [bitsPerPixel](coregraphics/cgcontext/bitsperpixel.md)
- [bytesPerRow](coregraphics/cgcontext/bytesperrow.md)
- [colorSpace](coregraphics/cgcontext/colorspace.md)
- [height](coregraphics/cgcontext/height.md)
- [width](coregraphics/cgcontext/width.md)
- [makeImage()](coregraphics/cgcontext/makeimage().md)
