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.
- ClPKCanvasViewiOS 13.0+A view that lets people draw interactively and displays drawing content.
- EnPKCanvasViewDrawingPolicyA policy that controls which input types can draw on the canvas.
- EnPKContentVersioniOS 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.
- PrPKTooliOS 13.0+A protocol adopted by the tools that draw, erase, and select ink on a canvas.
- StPKInkingTooliOS 13.0+A tool that draws ink strokes with a specified ink type, color, and width.
- StPKEraserTooliOS 13.0+A tool that erases ink, either by whole strokes or by pixel area, on the canvas.
- StPKLassoTooliOS 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.
- ClPKToolPickeriOS 13.0+A user interface for selecting a PKTool.
- ClPKToolPickerItemiOS 18.0+A user interface for a tool item in PKToolPicker.
- ClPKToolPickerInkingItemiOS 18.0+A user interface for an inking tool item in PKToolPicker.
- ClPKToolPickerEraserItemiOS 18.0+A user interface for an eraser tool item in PKToolPicker.
- ClPKToolPickerLassoItemiOS 18.0+A user interface for a lasso tool item in PKToolPicker.
- ClPKToolPickerCustomItemiOS 18.0+A user interface for a custom tool item in PKToolPicker.
- EnPKToolPickerVisibilityiOS 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.
- StPKDrawingiOS 13.0+A value type that captures the hand-drawn content of a canvas as a collection of strokes.
- StPKStrokeiOS 14.0+A value that represents a single stroke, including its path, ink, and transform.
- StPKStrokePathiOS 14.0+A value that describes the shape of a stroke as an interpolated sequence of points over time.
- StPKStrokePointiOS 14.0+A value that captures a sampled point along a stroke, including location, force, and azimuth.
- StPKInkiOS 14.0+PKInk provides a description of how marks on a PKCanvas render and are created.
- AcPKStrokeRecognizeriOS 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.
- ClPKDrawingReferenceiOS 13.0+The data model for a drawing that a `PKCanvasView` displays.
- ClPKStrokeReferenceiOS 14.0+The data model value representing a stroke in a `PKDrawing`.
- ClPKStrokePathReferenceiOS 14.0+A uniform cubic B-spline representing the point data of a `PKStroke`.
- ClPKStrokePointReferenceiOS 14.0+A value that stores all attributes of a stroke at a specific point.
- ClPKConvertedBezierPointReferenceiOS 27.0+Information about a B-spline control point converted from a Bézier path.
- ClPKInkReferenceiOS 14.0+PKInk provides a description of how marks on a PKCanvas render and are created.
- ClPKInkingToolReferenceiOS 13.0+A tool for drawing on a PKCanvasView.
- ClPKEraserToolReferenceiOS 13.0+An eraser tool for erasing parts of a drawing.
- ClPKLassoToolReferenceiOS 13.0+A lasso tool for selecting parts of a drawing.
- ClPKResponderStateiOS 26.0+The state of PencilKit behavior related to a `UIResponder`.
Protocols 2
- PrPKCanvasViewDelegateiOS 13.0+The optional methods a delegate receives from editing-related changes to the canvas view.
- PrPKToolPickerObserveriOS 13.0+