Agent skill · software engineering · dpearson2699
pencilkit
Add Apple Pencil drawing with PKCanvasView, PKToolPicker, PKDrawing serialization/export, stroke inspection, and PencilKit/PaperKit handoffs. Use when building drawing apps, annotation features, handwriting capture, signature fields, content-version-safe ink workflows, or Apple Pencil-powered experiences on iOS/iPadOS/visionOS.
Why this skill is useful
Provides specific implementation patterns and workflows for integrating Apple Pencil features that the AI wouldn't reliably generate on its own.
What it needs
About 7k tokens when loaded. Last updated 2026-07-31. 973 stars on the source repository.
What this skill does
PencilKit Capture Apple Pencil and finger input using PKCanvasView, manage drawing tools with PKToolPicker, serialize drawings with PKDrawing, and wrap PencilKit in SwiftUI. Contents Setup Capture-to-Export Workflow PKCanvasView Basics PKToolPicker PKDrawing Serialization Content Version Compatibility Exporting to Image Stroke Inspection SwiftUI Integration PaperKit Relationship Common Mistakes Review Checklist References Setup PencilKit requires no entitlements or Info.plist entries. Import PencilKit and create a PKCanvasView. Platform availability: iOS 13+, iPadOS 13+, Mac Catalyst 13.1+, visionOS 1.0+. Capture-to-Export Workflow 1. Capture: Read canvasView.drawing from canvasViewDrawingDidChange(:); keep the previous persisted revision until the new revision completes the remaining checkpoints. 2. Serialize: Create dataRepresentation(), write atomically, and run the decode validate/fix/retry loop. Do not mark bytes valid when PKDrawing(data:) still throws. 3. Version-gate: Apply Content Version Compatibility before editable sync. If the recipient cannot load the drawing, preserve the full-fidelity source and use an existing compatible fallback or read-only preview. 4. Sync: Send only validated, compatible data and mark the revision synced after acknowledgement. On transport or conflict failure, retain the pending revision, resolve the cause, and retry without discarding the last good copy. 5. Export: Validate a nonempty drawing region and intended scale before calling image(from:scale:); skip export on invalid bounds without altering the serialized drawing. PKCanvasView Basics PKCanvasView is a UIScrollView subclass that captures Apple Pencil and finger input and renders strokes. …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills dpearson2699/pencilkit