pencilkit
PencilKit
Apple's low-latency stroke-drawing engine — the ink behind Notes, Markup, and Screenshots. It captures Apple Pencil and finger input into vector strokes, renders them with a hardware-accelerated pipeline, and gives you a serializable model (PKDrawing) plus the system tool palette (PKToolPicker). Available iOS 13+. The deep API reference — canvas setup, SwiftUI wrapping, the tool picker, tools, persistence, image rendering, drawing policy, undo, Pencil Pro, and the PaperKit boundary — lives in references/guide.md. This file is the decision and discipline layer: read it first, open the guide for specifics.
Dials
Set these explicitly at the start; they change what "correct" means.
HOST—uikit(native;PKCanvasViewis a UIKit view, default) ·swiftui-representable(wrapPKCanvasViewin aUIViewRepresentablewith a Coordinator that owns the delegate and the tool picker — there is no first-party SwiftUI canvas).TOOLPICKER—shared(use a single long-livedPKToolPicker()for the system palette, default) ·none(custom toolbar; you setcanvasView.toolyourself and forfeit the Pencil-squeeze palette gesture).INPUT—any(drawingPolicy = .anyInput; finger and pencil both draw) ·pencil-only(drawingPolicy = .pencilOnly; pencil inks, finger pans/scrolls — the natural scrollable-canvas experience) ·default(.default; respects the user's system "Draw with Apple Pencil" setting).
When to use
Reach for PencilKit when you need freehand strokes only — a sketch pad, signature capture, handwriting input, or a pure-ink annotation overlay. It's lightweight and ships back to iOS 13. If you need structured markup elements (shapes, text boxes, stickers, images) and the system insertion UI on top of drawing, use PaperKit instead — PaperKit (iOS 26+) wraps a PencilKit drawing and adds the markup layer. Don't reimplement shapes/text on a bare PKCanvasView.