Framework

PencilKit

Capture touch input as an opaque drawing and display that content from your app.

Overview

PencilKit makes it easy to incorporate hand-drawn content into your iOS or macOS apps quickly and easily. PencilKit provides a drawing environment for your iOS app that takes input from Apple Pencil, or the user's finger, and turns it into high quality images you display in either iOS or macOS. The environment comes with tools for creating, erasing, and selecting lines.

You capture content in your iOS app using a PKCanvasView object. The canvas object is a view that you integrate into your existing view hierarchy. It supports the low-latency capture of touches originating from Apple Pencil or your finger. It then vends the final results as a PKDrawingReference object, whose contents you can save with your app’s content. You can also convert the drawn content into an image, which you can display in your iOS or macOS app.

Topics

Canvas

Drawing With PencilKit

Add expressive, low-latency drawing to your application with PencilKit.

class PKCanvasView

A view that captures Apple Pencil input and displays the rendered results in an iOS app.

struct PKDrawing

An opaque data object that contains the drawing information captured by a canvas view.

class PKDrawingReference

An opaque data object that contains the drawing information captured by a canvas view.

Tools

class PKToolPicker

An object that displays a selection of drawing tools and colors from which to select in the current window.

struct PKInkingTool

An object that defines the drawing characteristics (width, color, pen style) to use when drawing lines on a canvas view.

class PKInkingToolReference

An object that defines the drawing characteristics (width, color, pen style) to use when drawing lines on a canvas view.

struct PKEraserTool

A tool for erasing previously drawn content in a canvas view.

class PKEraserToolReference

A tool for erasing previously drawn content in a canvas view.

struct PKLassoTool

A tool for selecting stroked lines in a canvas view.

class PKLassoToolReference

A tool for selecting stroked lines in a canvas view.

protocol PKTool

An interface adopted by tools used by a canvas view.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software