TechnologiesUI & App Frameworks

PencilKit

iOSmacOStvOSwatchOSvisionOS

PencilKit captures Apple Pencil and touch input on a canvas to create, edit, and render hand-drawn ink drawings in your app. You add a PKCanvasView to your interface and pair it with a PKToolPicker so people can draw with an inking tool such as PKInkingTool, erase with PKEraserTool, or select strokes with PKLassoTool. The resulting artwork is captured as a PKDrawing composed of individual PKStroke values, each with a PKStrokePath and PKInk you can inspect, store, and re-render. On iOS, macOS, and visionOS, you can configure how the canvas responds to input through PKCanvasViewDrawingPolicy and customize the available tools using PKToolPickerItem subclasses like PKToolPickerInkingItem and PKToolPickerCustomItem.

Essentials 3

Display an interactive drawing canvas and choose how it interprets Apple Pencil and touch input.

  • Cl
    PKCanvasViewiOS 13.0+
    A view that lets people draw interactively and displays drawing content.
  • En
    PKCanvasViewDrawingPolicy
    A policy that controls which input types can draw on the canvas.
  • En
    PKContentVersioniOS 17.0+
    A version that specifies which PencilKit features a drawing uses or requires.

Drawing Tools 4

The inking, erasing, and selection tools people use to draw, remove, and select strokes on the canvas.

  • Pr
    PKTooliOS 13.0+
    A protocol adopted by the tools that draw, erase, and select ink on a canvas.
  • St
    PKInkingTooliOS 13.0+
    A tool that draws ink strokes with a specified ink type, color, and width.
  • St
    PKEraserTooliOS 13.0+
    A tool that erases ink, either by whole strokes or by pixel area, on the canvas.
  • St
    PKLassoTooliOS 13.0+
    A tool that selects strokes by drawing a freeform lasso around them.

Tool Picker 7

Present a palette of tools and configure or extend the items it displays.

  • Cl
    PKToolPickeriOS 13.0+
    A user interface for selecting a PKTool.
  • Cl
    PKToolPickerItemiOS 18.0+
    A user interface for a tool item in PKToolPicker.
  • Cl
    PKToolPickerInkingItemiOS 18.0+
    A user interface for an inking tool item in PKToolPicker.
  • Cl
    PKToolPickerEraserItemiOS 18.0+
    A user interface for an eraser tool item in PKToolPicker.
  • Cl
    PKToolPickerLassoItemiOS 18.0+
    A user interface for a lasso tool item in PKToolPicker.
  • Cl
    PKToolPickerCustomItemiOS 18.0+
    A user interface for a custom tool item in PKToolPicker.
  • En
    PKToolPickerVisibilityiOS 26.0+
    The visibility state of a tool picker.

Drawings and Strokes 6

The captured artwork and the individual strokes, paths, and points that compose it.

  • St
    PKDrawingiOS 13.0+
    A value type that captures the hand-drawn content of a canvas as a collection of strokes.
  • St
    PKStrokeiOS 14.0+
    A value that represents a single stroke, including its path, ink, and transform.
  • St
    PKStrokePathiOS 14.0+
    A value that describes the shape of a stroke as an interpolated sequence of points over time.
  • St
    PKStrokePointiOS 14.0+
    A value that captures a sampled point along a stroke, including location, force, and azimuth.
  • St
    PKInkiOS 14.0+
    PKInk provides a description of how marks on a PKCanvas render and are created.
  • Ac
    PKStrokeRecognizeriOS 27.0+
    An actor that recognizes handwritten strokes and searches for text in a drawing.

Objective-C Interoperability 10

Reference-type bridges that expose PencilKit value types to Objective-C and key-value coding.

  • Cl
    PKDrawingReferenceiOS 13.0+
    The data model for a drawing that a `PKCanvasView` displays.
  • Cl
    PKStrokeReferenceiOS 14.0+
    The data model value representing a stroke in a `PKDrawing`.
  • Cl
    PKStrokePathReferenceiOS 14.0+
    A uniform cubic B-spline representing the point data of a `PKStroke`.
  • Cl
    PKStrokePointReferenceiOS 14.0+
    A value that stores all attributes of a stroke at a specific point.
  • Cl
    PKConvertedBezierPointReferenceiOS 27.0+
    Information about a B-spline control point converted from a Bézier path.
  • Cl
    PKInkReferenceiOS 14.0+
    PKInk provides a description of how marks on a PKCanvas render and are created.
  • Cl
    PKInkingToolReferenceiOS 13.0+
    A tool for drawing on a PKCanvasView.
  • Cl
    PKEraserToolReferenceiOS 13.0+
    An eraser tool for erasing parts of a drawing.
  • Cl
    PKLassoToolReferenceiOS 13.0+
    A lasso tool for selecting parts of a drawing.
  • Cl
    PKResponderStateiOS 26.0+
    The state of PencilKit behavior related to a `UIResponder`.

Protocols 2

  • Pr
    PKCanvasViewDelegateiOS 13.0+
    The optional methods a delegate receives from editing-related changes to the canvas view.
  • Pr
    PKToolPickerObserveriOS 13.0+

Extends 2

__PKInkTypeUIResponder
← UI & App Frameworks