iOS 27 adds PKStrokeRecognizer to PencilKit, enabling on-device handwriting recognition across 29 languages, plus Bézier path conversion, stable stroke identity, selection access, and programmatic stroke slicing APIs.
• PKStrokeRecognizer runs fully on-device with no network required, letting any app search, index, or validate handwritten content without a privacy compromise
• Path conversion between PKStrokePath and Bézier paths means you can retrofit handwriting recognition onto existing custom canvas implementations — not just PKCanvasView
• Stable stroke UUIDs and programmatic erasing/substroke extraction unlock custom undo stacks, stroke-order animations, and interactive highlight features that were previously impossible
A SwiftUI view that lets the user draw on a PKCanvasView and taps a button to recognize what was written using PKStrokeRecognizer, displaying the result below the canvas.
import SwiftUI
import PencilKit
struct HandwritingCheckerView: View {
@State private var canvasView = PKCanvasView()
@State private var recognizedText: String = "Draw something above, then tap Recognize"
@State private var isRecognizing = false
var body: some View {
VStack(spacing: 16) {
Text("PencilKit Handwriting Recognition")
.font(.headline)
CanvasRepresentable(canvasView: $canvasView)
.frame(height: 260)
.border(Color.secondary, width: 1)
.cornerRadius(8)
HStack(spacing: 12) {
Button("Recognize") {
Task { await recognizeHandwriting() }
}
.buttonStyle(.borderedProminent)
.disabled(isRecognizing)
Button("Clear") {
canvasView.drawing = PKDrawing()
recognizedText = "Draw something above, then tap Recognize"
}
.buttonStyle(.bordered)
}
Text(recognizedText)
.font(.title2)
.multilineTextAlignment(.center)
.padding()
.frame(maxWidth: .infinity)
.background(Color(.secondarySystemBackground))
.cornerRadius(8)
Spacer()
}
.padding()
}
private func recognizeHandwriting() async {
guard !canvasView.drawing.strokes.isEmpty else {
recognizedText = "Please draw something first."
return
}
isRecognizing = true
defer { isRecognizing = false }
let recognizer = PKStrokeRecognizer()
// Optionally pin to a specific language:
// recognizer.preferredLanguages = [Locale.Language(identifier: "zh-Hans")]
let drawing = canvasView.drawing
let strokeIDs = drawing.strokes.map(\.id)
do {
let result = try await recognizer.recognizedText(
in: drawing,
strokeIDs: strokeIDs
)
recognizedText = result.isEmpty ? "(nothing recognized)" : result
} catch {
recognizedText = "Recognition failed: \(error.localizedDescription)"
}
}
}
struct CanvasRepresentable: UIViewRepresentable {
@Binding var canvasView: PKCanvasView
func makeUIView(context: Context) -> PKCanvasView {
canvasView.tool = PKInkingTool(.pen, color: .label, width: 5)
canvasView.backgroundColor = .systemBackground
canvasView.drawingPolicy = .anyInput
return canvasView
}
func updateUIView(_ uiView: PKCanvasView, context: Context) {}
}
#Preview {
HandwritingCheckerView()
}Liquid Glass is Apple's new material and visual design language introduced in iOS 27, bringing translucent, refractive glass-like surfaces to system and custom UI elements. It replaces the frosted vibrancy aesthetic with a more dynamic, depth-aware material that responds to content beneath it.
PaperKit is Apple's full-featured canvas framework — previously internal-only — now publicly available in iOS/macOS/visionOS 27. It powers the drawing and markup experience in Notes, Preview, and Freeform, giving developers access to a complete pencil, shapes, images, and text canvas with a rich data model.
Xcode 27 introduces a fully customizable toolbar and theme system, untitled scratch projects, coding agent integration directly in the editor, and the new Device Hub for evaluating apps across simulators and physical devices side-by-side.
In-depth guide
SwiftUI & Liquid Glass in iOS 27 →Recognition is async (PKStrokeRecognizer is a Swift actor); throttle calls to avoid excess power use. Stroke slicing on complex drawings can be expensive — prefer a background task. Indexable content should be re-indexed when recognizerVersion changes. Bézier conversion does not carry PencilKit-specific properties like force or opacity — you must supply those manually.
Handwriting recognition works on all iOS 27-supported devices; Simulator only supports Latin-character languages. Apple Pencil is not strictly required — any PKDrawing can be recognized.
iOS 27 introduces new SwiftUI drag and drop APIs including reorderable, reorderContainer, dragContainer, and configuration modifiers that enable reordering within and across collections, multi-item drag, and fine-grained control over how data is transferred during drag and drop operations.