<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.15.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "PencilKit",
  "identifier" : "/documentation/PencilKit/PKDrawingReference",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "PencilKit"
    ],
    "preciseIdentifier" : "c:objc(cs)PKDrawing"
  },
  "title" : "PKDrawingReference"
}
-->

# PKDrawingReference

A data structure that contains the drawing information captured by a canvas view.

```
class PKDrawingReference
```

## Overview

A [`PKDrawingReference`](/documentation/PencilKit/PKDrawingReference) object stores the user-drawn content from a [`PKCanvasView`](/documentation/PencilKit/PKCanvasView) object. You use drawing objects to store the data associated with your user’s drawings. You can save this data with the rest of your app’s content, and you can use that saved data to create a new drawing object later. You can also generate an image based on the drawn content.

## Topics

### Creating a drawing object

[`-  initWithData:error:`](/documentation/PencilKit/PKDrawingReference/init(data:))

Creates a drawing object and populates it with previously drawn content.

[`-  initWithStrokes:`](/documentation/PencilKit/PKDrawingReference/init(strokes:))

Creates a drawing object with the strokes you supply.

[`-  init`](/documentation/PencilKit/PKDrawingReference/init())

Creates an empty drawing object.

### Getting the canvas bounds

[`bounds`](/documentation/PencilKit/PKDrawingReference/bounds)

The smallest rectangle used to represent the content’s bounds, taking into account line widths of that content.

### Generating an image

[`-  imageFromRect:scale:`](/documentation/PencilKit/PKDrawingReference/image(from:scale:))

Returns an image object that contains the specified portion of the drawing.

### Getting the drawing data

[`strokes`](/documentation/PencilKit/PKDrawingReference/strokes)

An array of strokes used to represent the drawing.

[`-  dataRepresentation`](/documentation/PencilKit/PKDrawingReference/dataRepresentation())

Returns a representation of the rendered content as data.

[`PKAppleDrawingTypeIdentifier`](/documentation/PencilKit/PKAppleDrawingTypeIdentifier)

The uniform type identifier for data associated with a drawing object.

### Modifying the drawing

[`-  drawingByApplyingTransform:`](/documentation/PencilKit/PKDrawingReference/applying(_:))

Returns a new drawing object by applying the specified transform to a copy of the current object’s contents.

[`-  drawingByAppendingStrokes:`](/documentation/PencilKit/PKDrawingReference/appendingStrokes(_:))

Returns a copy of the current drawing with the strokes you provide appended.

[`-  drawingByAppendingDrawing:`](/documentation/PencilKit/PKDrawingReference/appending(_:))

Returns a new drawing created by appending the current drawing with another drawing you provide.

### Supporting backward compatibility

[`requiredContentVersion`](/documentation/PencilKit/PKDrawingReference/requiredContentVersion)

The version of PencilKit necessary to use the drawing.

## Relationships

### Conforms To

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`NSCoding`](/documentation/Foundation/NSCoding)

[`NSSecureCoding`](/documentation/Foundation/NSSecureCoding)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`CVarArg`](/documentation/Swift/CVarArg)

[`Hashable`](/documentation/Swift/Hashable)

[`NSCopying`](/documentation/Foundation/NSCopying)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`Equatable`](/documentation/Swift/Equatable)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`Sendable`](/documentation/Swift/Sendable)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

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)