RORK LABJP
TEST — The Rork Companion app lets you test on a real iPhone without a paid Apple Developer accountCLOUD — Code compiles on a cloud Mac, streaming a 60fps live simulator with real touch inputBROWSER — Design, code, and test entirely in Chrome or Safari — no Xcode requiredPUBLISH — Two-click App Store publishing keeps the submission process simpleMAX — Rork Max builds native Swift apps for iPhone, iPad, Apple Watch, and Vision ProRN — Standard Rork generates iOS and Android apps together with React Native (Expo)TEST — The Rork Companion app lets you test on a real iPhone without a paid Apple Developer accountCLOUD — Code compiles on a cloud Mac, streaming a 60fps live simulator with real touch inputBROWSER — Design, code, and test entirely in Chrome or Safari — no Xcode requiredPUBLISH — Two-click App Store publishing keeps the submission process simpleMAX — Rork Max builds native Swift apps for iPhone, iPad, Apple Watch, and Vision ProRN — Standard Rork generates iOS and Android apps together with React Native (Expo)
Articles/Dev Tools
Dev Tools/2026-05-03Advanced

Building a Production-Grade Handwriting Note App with Rork × PencilKit

How to ship a real PencilKit-based note app with Rork — covering Apple Pencil Pro Squeeze and Hover, PKDrawing persistence, CloudKit sync, and Vision-based handwriting OCR with production patterns.

Rork470PencilKitApple PenciliPad appSwiftUI55Handwriting

Premium Article

If you have ever tried building a handwriting note app for iPad, you probably had the same arc I did: dropped a PKCanvasView in, felt great for ten minutes, then hit a wall the second you wanted to save the drawing, support Apple Pencil Pro's Squeeze gesture, or sync notes across devices.

I have been shipping handwriting-focused iPad apps for the past three years, and PencilKit is one of the most deceptively simple frameworks Apple has produced. The gap between "it works on screen" and "it can compete on the App Store" is much wider than the API surface suggests.

This guide walks through the patterns I have actually used — and the mistakes I have actually made — when building PencilKit-backed apps with Rork (in particular Rork Max generating SwiftUI native code). We will cover Apple Pencil Pro features (Squeeze, Barrel Roll, Hover, Haptics), persisting PKDrawing, syncing with CloudKit, and adding searchability via Vision-based handwriting OCR — all as production-ready patterns.

Why pick PencilKit at all — the trade-off versus rolling your own

There is one architectural decision you cannot avoid: should the drawing layer be PencilKit, a custom Metal renderer, or a third-party SDK like PSPDFKit?

When in doubt, I always pick PencilKit, for three reasons.

First, you get Apple Pencil Pro features (Squeeze, Barrel Roll, Hover) almost for free. If you build your own renderer, you have to wire up UIPencilInteraction, UIHoverGestureRecognizer, the haptic engine, and detection logic for Pencil generations — every single piece by hand.

Second, Apple keeps polishing PencilKit each year, and PKToolPicker matches the look and feel of the system Notes and Freeform apps. Users come in expecting that interaction model, so matching it is itself a UX win.

Third, you get Scribble (handwriting-to-text on input) and PKDrawing.image() for fast rasterization completely free. Building OCR or PDF rendering of comparable quality on your own takes months.

The case where PencilKit is the wrong call is when complex layer systems or a custom brush engine are the core product (think Procreate). For the typical "notes / meetings / study / PDF annotation" category, PencilKit is the right answer — and that is what this article focuses on.

Architecture overview — keeping responsibilities clean in Rork

Before writing a line of code in Rork, decide where SwiftUI ends and UIKit begins. PKCanvasView is UIKit, so a UIViewRepresentable bridge is mandatory.

The four-layer setup I use looks like this:

  • View layer (SwiftUI): note list, toolbar, page thumbnails
  • Canvas layer (UIViewRepresentable): bridges PKCanvasView and PKToolPicker
  • Document layer (@Observable): holds PKDrawing and Page state, owns Undo/Redo
  • Persistence layer: a repository that abstracts FileManager and CloudKit

When you prompt Rork Max, declare these layers explicitly. Saying something like "create a CanvasRepresentable that exposes PKCanvasView to SwiftUI, and pipe PKDrawing into a @Bindable Document" keeps the generated code consistent through later sync and OCR work.

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
If you got stuck once you tried PencilKit beyond a one-liner — laggy strokes, the tool picker not showing, no clue how to support Apple Pencil Pro Squeeze — you can leave today with production-grade code that does all of it
You will learn how to persist PKDrawing properly and sync notes across devices with a realistic CloudKit + CKAsset architecture, debounced and conflict-aware
You can transplant a complete monetization recipe — Pencil Pro support, subscription gating, and OCR search — into your own handwriting app
Secure payment via Stripe · Cancel anytime

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Rork Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

Related Articles

Dev Tools2026-04-23
Integrating Siri and Shortcuts into Rork Apps: App Intents with Expo, Without the Pitfalls
A production-grade guide to adding Siri Shortcuts and App Intents to a React Native app generated by Rork. Bridge native Swift via an Expo Config Plugin, model AppShortcut / AppEntity / EntityQuery correctly, and ship Donations and Control Center widgets without breaking Apple's conventions.
Dev Tools2026-06-28
Ship EAS Updates to a Few First, and Halt Automatically on Crash Rate
Because OTA updates reach everyone instantly, a bad update reaches everyone instantly too. Here is a three-layer design: ship EAS Update to a small canary, decide expand-or-halt from crash-free rate automatically, and hold a safety net on the device — with working code.
Dev Tools2026-06-28
When your Rork app's production crashes arrive minified — wiring Hermes source maps and debug IDs into Sentry
Rork-generated Expo apps run on Hermes, so production crashes often arrive as index.bundle:1:284913 with no function names. Here is how to wire Hermes source maps and debug IDs into Sentry so your stack traces become readable.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →