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

# PKStrokeReference

A class that represents the paths, boundaries and other properties of a stroke drawn on a canvas.

```
class PKStrokeReference
```

## Topics

### Creating a stroke object

[`init(ink: PKInk, strokePath: PKStrokePath, transform: CGAffineTransform, mask: UIBezierPath?)`](/documentation/PencilKit/PKStrokeReference/init(ink:strokePath:transform:mask:))

Creates a stroke with the line properties, path, transform, and mask that you specify.

[`init(ink: PKInk, strokePath: PKStrokePath, transform: CGAffineTransform, mask: UIBezierPath?, randomSeed: UInt32)`](/documentation/PencilKit/PKStrokeReference/init(ink:strokePath:transform:mask:randomSeed:))

Creates a stroke with the line properties, path, transform, mask, and random seed that you specify.

### Getting the stroke properties

[`var ink: PKInk`](/documentation/PencilKit/PKStrokeReference/ink)

The line properties used to render this stroke.

[`var mask: UIBezierPath?`](/documentation/PencilKit/PKStrokeReference/mask)

The pretransform mask used to clip the rendering of the stroke.

[`var maskedPathRanges: [__PKFloatRange]`](/documentation/PencilKit/PKStrokeReference/maskedPathRanges)

The range of points in the stroke path reference that intersect the stroke’s mask.

[`var path: PKStrokePath`](/documentation/PencilKit/PKStrokeReference/path)

The B-spline path that describes this stroke.

[`var renderBounds: CGRect`](/documentation/PencilKit/PKStrokeReference/renderBounds)

The bounds of the rendered stroke, including the width and line properties of the stroke after applying the transform.

[`var transform: CGAffineTransform`](/documentation/PencilKit/PKStrokeReference/transform)

The affine transform of the stroke after rendering.

[`var randomSeed: UInt32`](/documentation/PencilKit/PKStrokeReference/randomSeed)

An unsigned 32-bit integer to use as a random seed for drawing strokes that use randomized effects.

### Supporting backward compatibility

[`var requiredContentVersion: PKContentVersion`](/documentation/PencilKit/PKStrokeReference/requiredContentVersion)

The version of PencilKit necessary to use the stroke.

### Initializers

[`init(ink: PKInk, strokePath: PKStrokePath, transform: CGAffineTransform, mask: UIBezierPath?, randomSeed: UInt32, strokeID: UUID, renderGroupID: UUID?, renderState: PKStrokeRenderStateReference?)`](/documentation/PencilKit/PKStrokeReference/init(ink:strokePath:transform:mask:randomSeed:strokeID:renderGroupID:renderState:))

### Instance Properties

[`var renderGroupID: UUID?`](/documentation/PencilKit/PKStrokeReference/renderGroupID)

A UUID that groups strokes for wet-ink compositing with compatible inks such as marker.

[`var renderState: PKStrokeRenderStateReference?`](/documentation/PencilKit/PKStrokeReference/renderState)

The render details of the stroke, such as particle positioning. Uses default rendering when nil.

[`var strokeID: UUID`](/documentation/PencilKit/PKStrokeReference/strokeID)

The unique identity of the stroke.

### Instance Methods

[`func substroke(with: __PKFloatRange) -> PKStroke`](/documentation/PencilKit/PKStrokeReference/substroke(with:))

Returns a copy of the stroke containing the control points in the specified range.

## Relationships

### Conforms To

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

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

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

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

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

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

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

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

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

### 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)