Skip to content
Development
Skill

/paperkit

Add drawings, shapes, and a consistent markup experience using PaperKit. Use when integrating PaperMarkupViewController for markup editing, adding shape recognition, working with PaperMarkup data models, embedding markup tools in document editors, or building annotation features

From plugin
swift-ios-skills
98186 skills1 MCP
Install
$ npx -y skills add dpearson2699/swift-ios-skills --skill paperkit --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/paperkit

Context preview

The summary Claude sees to decide when to auto-load this skill.

Add drawings, shapes, and a consistent markup experience using PaperKit. Use when integrating PaperMarkupViewController for markup editing, adding shape recognition, working with PaperMarkup data models, embedding markup tools in document editors, or building annotation features

SKILL.md

paperkit.SKILL.md
name: paperkit
description: "Add drawings, shapes, and a consistent markup experience using PaperKit. Use when integrating PaperMarkupViewController for markup editing, adding shape recognition, working with PaperMarkup data models, embedding markup tools in document editors, or building annotation features that need the system-standard markup toolbar. New in iOS 26."

PaperKit

> **Beta-sensitive.** PaperKit is new in iOS/iPadOS 26, macOS 26, and visionOS 26. API surface may change. Verify details against current Apple documentation before shipping.

PaperKit combines PencilKit drawing with structured markup elements such as shapes, text, images, and lines in a canvas managed by `PaperMarkupViewController`.

Contents

  • [Setup](#setup)
  • [Workflow](#workflow)
  • [PaperMarkupViewController](#papermarkupviewcontroller)
  • [PaperMarkup Data Model](#papermarkup-data-model)
  • [Insertion Controllers](#insertion-controllers)
  • [FeatureSet Configuration](#featureset-configuration)
  • [Integration with PencilKit](#integration-with-pencilkit)
  • [SwiftUI Integration](#swiftui-integration)
  • [Common Mistakes](#common-mistakes)
  • [Review Checklist](#review-checklist)
  • [References](#references)

Workflow

1. Choose the document bounds, supported `FeatureSet`, and persistence version before constructing UI. 2. Create `PaperMarkup`, embed `PaperMarkupViewController`, and keep the controller, tool picker, and insertion controller alive for the view lifetime. 3. Use the platform-appropriate insertion surface and keep PencilKit drawing inside the PaperKit document boundary. 4. Save off the main thread, retain a thumbnail for forward-incompatible content, and test round-trip loading with the same feature set. 5. On failure, restore the original document bytes, fix the feature-set/version/controller mismatch, and rerun edit, save, relaunch, load, thumbnail fallback, and undo checks.

Load [references/paperkit-patterns.md](references/paperkit-patterns.md) for full platform setup, tool picker wiring, persistence, thumbnails, custom feature sets, programmatic construction, and migration.

Setup

PaperKit requires no entitlements or special Info.plist entries.

import PaperKit

**Platform availability:** iOS 26.0+, iPadOS 26.0+, Mac Catalyst 26.0+, macOS 26.0+, visionOS 26.0+.

Three core components:

| Component | Role | |---|---| | `PaperMarkupViewController` | Interactive canvas for creating and displaying markup and drawing | | `PaperMarkup` | Data model for serializing all markup elements and PencilKit drawing | | `MarkupEditViewController` / `MarkupToolbarViewController` | Insertion UI for adding markup elements |

PaperMarkupViewController

The primary view controller for interactive markup. Provides a scrollable canvas for freeform PencilKit drawing and structured markup elements. Conforms to `Observable` and `PKToolPickerObserver`.

Basic UIKit Setup

import PaperKit
import PencilKit
import UIKit

class MarkupViewController: UIViewController, PaperMarkupViewController.Delegate {
    var paperVC: PaperMarkupViewController!
    var toolPicker: PKToolPicker!

    override func viewDidLoad() {
        super.viewDidLoad()

        let pageBounds = CGRect(origin: .zero, size: CGSize(width: 612, height: 792))
        let markup = PaperMarkup(bounds: pageBounds)
        let features = FeatureSet.latest

        paperVC = PaperMarkupViewController(
            markup: markup,
            supportedFeatureSet: features
        )
        paperVC.delegate = self

        addChild(paperVC)
        paperVC.view.frame = view.bounds
        paperVC.view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
        view.addSubview(paperVC.view)
        paperVC.didMove(toParent: self)

        toolPicker = PKToolPicker()
        toolPicker.addObserver(paperVC)
        paperVC.pencilKitResponderState.activeToolPicker = toolPicker
        paperVC.pencilKitResponderState.toolPickerVisibility = .visible
    }

    func paperMarkupViewControllerDidChangeMarkup(
        _ controller: PaperMarkupViewController
    ) {
        guard let markup = controller.markup else { return }
        Task { try await save(markup) }
    }
}

Key Properties

| Property | Type | Description | |---|---|---| | `markup` | `PaperMarkup?` | The current data model | | `selectedMarkup` | `PaperMarkup` | Currently selected content | | `isEditable` | `Bool` | Whether the canvas accepts input | | `isRulerActive` | `Bool` | Whether the ruler overlay is shown | | `drawingTool` | `any PKTool` | Active PencilKit drawing tool | | `contentView` | `UIView?` / `NSView?` | Background view rendered beneath markup | | `zoomRange` | `ClosedRange<CGFloat>` | Min/max zoom scale | | `supportedFeatureSet` | `FeatureSet` | Enabled PaperKit features |

Touch Modes

`PaperMarkupViewController.TouchMode` has two cases: `.drawing` and `.selection`.

paperVC.directTouchMode = .drawing    // Finger draws
paperVC.directTouchMode = .selection  // Finger selects elements
paperVC.directTouchAutomaticallyDraws = true  // System decides based on Pencil state

Content Background

Set any view beneath the markup layer for templates, document pages, or images being annotated. Keep the `PaperMarkup(bounds:)` coordinate space aligned to the background content, such as a PDF page or rendered image size, so saved annotations restore in the right place:

let pageBounds = CGRect(origin: .zero, size: pageImage.size)
let imageView = UIImageView(image: pageImage)
imageView.frame = pageBounds

let markup = PaperMarkup(bounds: pageBounds)
paperVC = PaperMarkupViewController(markup: markup, supportedFeatureSet: features)
paperVC.contentView = imageView

Delegate Callbacks

| Method | Called when | |---|---| | `paperMarkupViewControllerDidChangeMarkup(_:)` | Markup content changes | | `paperMarkupViewControllerDidBeginDrawing(_:)` | User starts drawing | | `paperMarkupViewControllerDidChangeSelection(_:)` | Se

Read more
Ships withswift-ios-skills

86 agent skills optimized for iOS 26+ development with Swift 6.3 and modern Apple frameworks.

Get the whole plugin
Stats
981
Stars
50
Forks
Active
Maintenance
Python
Language
9d ago
Last commit
5mo ago
Created

Repo: dpearson2699/swift-ios-skills

Other skills on swift-ios-skills.