One Logo Pool Ball
PencilKit · IOS API REFERENCE

PKStroke

struct · iOS 14.0+ · SDK 27.1

struct PKStroke

Members (23)

get · iOS 16.0+

randomSeed

TypeScript
get randomSeed(): number
Swift declaration
var randomSeed: UInt32 { get set }

The random seed for drawing strokes that use randomized effects.

set · iOS 16.0+

randomSeed

TypeScript
set randomSeed(value: number)
Swift declaration
var randomSeed: UInt32 { get set }

The random seed for drawing strokes that use randomized effects.

get · iOS 27.0+

renderState

TypeScript
get renderState(): (PKStroke_RenderState) | null
Swift declaration
var renderState: PKStroke.RenderState? { get set }

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.

set · iOS 27.0+

renderState

TypeScript
set renderState(value: (PKStroke_RenderState) | null)
Swift declaration
var renderState: PKStroke.RenderState? { get set }

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.

get · iOS 14.0+

renderBounds

TypeScript
get renderBounds(): { x: number; y: number; width: number; height: number }
Swift declaration
var renderBounds: CGRect { get }

The bounds of the rendered stroke. This includes the width & ink of the stroke after the transform is applied.

get · iOS 27.0+

renderGroupID

TypeScript
get renderGroupID(): (string) | null
Swift declaration
var renderGroupID: UUID? { get set }

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.

set · iOS 27.0+

renderGroupID

TypeScript
set renderGroupID(value: (string) | null)
Swift declaration
var renderGroupID: UUID? { get set }

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.

get · iOS 14.0+

maskedPathRanges

TypeScript
get maskedPathRanges(): Array<"animatableData" | SDKHandle>
Swift declaration
var maskedPathRanges: [ClosedRange<CGFloat>] { get }

These are the parametric parameter ranges of points in `strokePath` that intersect the stroke's mask.

get · iOS 17.0+

requiredContentVersion

TypeScript
get requiredContentVersion(): PKContentVersion
Swift declaration
var requiredContentVersion: PKContentVersion { get }

The PencilKit version required to use this stroke.

get · iOS 27.0+

id

TypeScript
get id(): string
Swift declaration
var id: UUID { get set }

The unique identity of the stroke.

set · iOS 27.0+

id

TypeScript
set id(value: string)
Swift declaration
var id: UUID { get set }

The unique identity of the stroke.

init · iOS 27.0+

init

TypeScript
static initInkPathTransformMaskRandomSeedIdRenderGroupIDRenderState(ink: PKInk, path: PKStrokePath, transform?: _CoreFoundation_CGAffineTransform, mask?: (_UIKit_UIBezierPath) | null, randomSeed?: number, id?: string, renderGroupID?: (string) | null, renderState?: (PKStroke_RenderState) | null): PKStroke
Swift declaration
init(ink: PKInk, path: PKStrokePath, transform: CGAffineTransform = .identity, mask: UIBezierPath? = nil, randomSeed: UInt32 = UInt32.random(in: 0...UInt32.max), id: UUID = UUID(), renderGroupID: UUID? = nil, renderState: PKStroke.RenderState? = nil)
init · iOS 16.0+

init

TypeScript
static initInkPathTransformMaskRandomSeed(ink: PKInk, path: PKStrokePath, transform: _CoreFoundation_CGAffineTransform, mask: (_UIKit_UIBezierPath) | null, randomSeed: number): PKStroke
Swift declaration
init(ink: PKInk, path: PKStrokePath, transform: CGAffineTransform = .identity, mask: UIBezierPath? = nil, randomSeed: UInt32)
init · iOS 14.0+

init

TypeScript
static initInkPathTransformMask(ink: PKInk, path: PKStrokePath, transform?: _CoreFoundation_CGAffineTransform, mask?: (_UIKit_UIBezierPath) | null): PKStroke
Swift declaration
init(ink: PKInk, path: PKStrokePath, transform: CGAffineTransform = .identity, mask: UIBezierPath? = nil)
get · iOS 14.0+

ink

TypeScript
get ink(): PKInk
Swift declaration
var ink: PKInk { get set }

The ink used to render this stroke.

set · iOS 14.0+

ink

TypeScript
set ink(value: PKInk)
Swift declaration
var ink: PKInk { get set }

The ink used to render this stroke.

get · iOS 14.0+

mask

TypeScript
get mask(): (_UIKit_UIBezierPath) | null
Swift declaration
var mask: UIBezierPath? { get set }
set · iOS 14.0+

mask

TypeScript
set mask(value: (_UIKit_UIBezierPath) | null)
Swift declaration
var mask: UIBezierPath? { get set }
get · iOS 14.0+

path

TypeScript
get path(): PKStrokePath
Swift declaration
var path: PKStrokePath { get set }

The B-spline path data that describes this stroke.

set · iOS 14.0+

path

TypeScript
set path(value: PKStrokePath)
Swift declaration
var path: PKStrokePath { get set }

The B-spline path data that describes this stroke.

method · iOS 27.0+

substroke

TypeScript
substroke(range: "animatableData" | SDKHandle): PKStroke
Swift declaration
func substroke(range: ClosedRange<CGFloat>) -> PKStroke

Returns a copy of this stroke containing the control points in the given range. Maintains information for PencilKit rendering to make the copied part of the stroke render the same as the receiver. The returned stroke may have a `renderState` set to maintain this information. - Parameter range: The range of control points in the receiver to copy to the returned stroke. - Returns: A new stroke containing only the control points within the specified range.

get · iOS 14.0+

transform

TypeScript
get transform(): _CoreFoundation_CGAffineTransform
Swift declaration
var transform: CGAffineTransform { get set }

The affine transform of the stroke when rendered.

set · iOS 14.0+

transform

TypeScript
set transform(value: _CoreFoundation_CGAffineTransform)
Swift declaration
var transform: CGAffineTransform { get set }

The affine transform of the stroke when rendered.

Skipped declarations

No declarations were skipped in this snapshot.

All PencilKit types →