<!--
{
  "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/PKStroke-swift.struct",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "PencilKit"
    ],
    "preciseIdentifier" : "s:9PencilKit8PKStrokeV"
  },
  "title" : "PKStroke"
}
-->

# PKStroke

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

```
struct PKStroke
```

## Topics

### Creating a stroke object

[`init(ink:path:transform:mask:)`](/documentation/PencilKit/PKStroke-swift.struct/init(ink:path:transform:mask:)-1imp6)

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

[`init(ink:path:transform:mask:)`](/documentation/PencilKit/PKStroke-swift.struct/init(ink:path:transform:mask:)-w7ti)

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

[`init(ink:path:transform:mask:randomSeed:)`](/documentation/PencilKit/PKStroke-swift.struct/init(ink:path:transform:mask:randomSeed:)-10m5j)

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

[`init(ink:path:transform:mask:randomSeed:)`](/documentation/PencilKit/PKStroke-swift.struct/init(ink:path:transform:mask:randomSeed:)-epus)

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

### Getting the stroke properties

[`ink`](/documentation/PencilKit/PKStroke-swift.struct/ink)

The Ink, which is a combination of a tool used to render this stroke.

[`mask`](/documentation/PencilKit/PKStroke-swift.struct/mask-8g6sx)

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

[`mask`](/documentation/PencilKit/PKStroke-swift.struct/mask-16kkz)

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

[`maskedPathRanges`](/documentation/PencilKit/PKStroke-swift.struct/maskedPathRanges)

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

[`path`](/documentation/PencilKit/PKStroke-swift.struct/path)

The B-spline path that describes this stroke.

[`renderBounds`](/documentation/PencilKit/PKStroke-swift.struct/renderBounds)

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

[`transform`](/documentation/PencilKit/PKStroke-swift.struct/transform)

The affine transform of the stroke after rendering.

[`randomSeed`](/documentation/PencilKit/PKStroke-swift.struct/randomSeed)

### Identifying the stroke

[`id`](/documentation/PencilKit/PKStroke-swift.struct/id)

The unique identity of the stroke.

### Manipulating strokes

[`substroke(range:)`](/documentation/PencilKit/PKStroke-swift.struct/substroke(range:))

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

### Configuring rendering

[`renderGroupID`](/documentation/PencilKit/PKStroke-swift.struct/renderGroupID)

Strokes with certain inks (such as marker) can composite to look as if they were drawn while the previous stroke with the same ink was still wet.
This UUID may be set to a single value for a run of strokes which should be rendered together in this manner.

[`renderState`](/documentation/PencilKit/PKStroke-swift.struct/renderState-swift.property)

Contains information about the render details (such as particle positioning) of this stroke, which can be useful when manipulating the model in certain ways.
For example, this may be set on substrokes returned by `substroke(range:)`.
nil uses default rendering.

[`PKStroke.RenderState`](/documentation/PencilKit/PKStroke-swift.struct/RenderState-swift.struct)

A value that captures the render-time state of a stroke, such as grain texture position.

### Supporting backward compatibility

[`requiredContentVersion`](/documentation/PencilKit/PKStroke-swift.struct/requiredContentVersion)

The version of PencilKit necessary to use the stroke.

### Using reference types

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

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



---

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)