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 PKDrawing 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

PKCanvasView

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

PKDrawing

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

Tools

PKToolPicker

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

PKInkingTool

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

PKEraserTool

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

PKLassoTool

A tool for selecting stroked lines in a canvas view.

PKTool

An abstract base class for tools used by a canvas view.