accessorysetupkit
Discover and configure Bluetooth and Wi-Fi accessories using AccessorySetupKit. Use when presenting a privacy-preserving accessory picker, defining discovery…
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
$ npx -y skills add dpearson2699/swift-ios-skills --skill paperkit --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/paperkitContext 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
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."
> **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`.
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.
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 |
The primary view controller for interactive markup. Provides a scrollable canvas for freeform PencilKit drawing and structured markup elements. Conforms to `Observable` and `PKToolPickerObserver`.
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) }
}
}| 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 |
`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
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
| Method | Called when | |---|---| | `paperMarkupViewControllerDidChangeMarkup(_:)` | Markup content changes | | `paperMarkupViewControllerDidBeginDrawing(_:)` | User starts drawing | | `paperMarkupViewControllerDidChangeSelection(_:)` | Se
86 agent skills optimized for iOS 26+ development with Swift 6.3 and modern Apple frameworks.
Repo: dpearson2699/swift-ios-skills
Discover and configure Bluetooth and Wi-Fi accessories using AccessorySetupKit. Use when presenting a privacy-preserving accessory picker, defining discovery…
Implement, review, or improve Live Activities and Dynamic Island experiences in iOS apps using ActivityKit. Use when building real-time updating widgets for…
Measure ad effectiveness with privacy-preserving attribution using AdAttributionKit. Use when registering ad impressions, handling attribution postbacks,…
Implement AlarmKit alarms and countdown timers for iOS and iPadOS with Lock Screen, Dynamic Island, StandBy, and paired Apple Watch system UI. Covers…
Build iOS App Clips with invocation URLs, App Clip Codes, NFC, QR codes, Safari banners, Maps, Messages, target setup, App Store Connect experiences,…
Implement App Intents for Siri, Shortcuts, Spotlight, widgets, Control Center, and Apple Intelligence on iOS. Covers AppIntent actions, AppEntity and…