Questions tagged [pencilkit]

PencilKit is Apple's framework for capturing touch input as an opaque drawing and displaying that content from your app.

PencilKit is Apple's framework for capturing touch input as an opaque drawing and displaying that content from your app.

Apple first revealed PencilKit at WWDC on June 3, 2019, and made it available in the first beta release of Xcode 11.

PencilKit is part of the following SDKs:

  • iOS 13.0 and later,
  • macOS 10.15 and later,
  • Mac Catalyst 13.0 and later.
140 questions
24
votes
0 answers

Implementing PencilKit with PDFKit

My app shows PDF files using the PDFKit and lets users make annotations on pdf files through my own code using UIKit and CoreGraphics frameworks. Since I would like to use the PencilKit framework to make annotations better, I’m in the process to…
Alcovi
  • 241
  • 2
  • 3
11
votes
1 answer

Can we add text, shape and signature in Photo Markup with Pencil Kit?

I am not getting any option to add text, shape and signature while markup a photo with PencelKit in my app. This option is available in Apple's Photos App. I have tried to access this with various properties of CanvasView and PKToolPicker, but with…
abhishek
  • 111
  • 1
  • 4
11
votes
0 answers

Initial position for PKToolPicker (PencilKit)?

How to setup PKToolPicker initial position? It always started at the bottom, and if there is a toolbar, cover up the toolbar. let toolPicker = PKToolPicker.shared(for: self.view.window!) toolPicker?.addObserver(canvas) toolPicker?.setVisible(true,…
Lim Thye Chean
  • 8,704
  • 9
  • 49
  • 88
11
votes
4 answers

How do I convert or load a UIImage into a PKDrawing?

I'd like to be able to load a PNG file into a PKCanvasView to be able to draw on and erase parts of it. Is there a way to accomplish this?
rawbee
  • 2,946
  • 3
  • 18
  • 22
10
votes
2 answers

Using PencilKit in dark mode results in wrong color

When in dark mode, it seems that all the color set in PKInkingTool are reversed in brightness. If I choose a bright red I got a dark red, and vice versa. For example, if I use UIColorPickerViewController to select a color: PKInkingTool(.pencil,…
Lim Thye Chean
  • 8,704
  • 9
  • 49
  • 88
9
votes
0 answers

Is it possible to add custom tools to a PKToolPicker?

If I draw for example with the Notes app I can see that there is a custom tool that can be used for handwriting. Now in my case I don't want to implement handwriting, but I need a custom tool that I can use to draw elements like arrows. In short, I…
Ramy Al Zuhouri
  • 21,580
  • 26
  • 105
  • 187
9
votes
1 answer

Customize PKToolPicker tools

PKToolPicker in PencilKit (iOS 13+) comes with default tools that are pen, marker, pencil, eraser, lasso, ruler and color pickers on iOS. on iPadOS this is extended with undo/redo and a (...) menu that provides an "auto minimize" option for the…
Arshia
  • 334
  • 2
  • 13
9
votes
2 answers

iOS PencilKit Draw shapes programmatically

I'm trying to figure out how to modify the PKDrawing property from PKCanvasView to add some shapes like circles or at least add a line however PKDrawing is an opaque type so there is not too much to do. Is there any workaround to create shapes or…
8
votes
0 answers

PencilKit plus button not showing on ToolPicker

I'm trying to use ToolPicker on my canvas, but here what I have : and I want (button + and text, shapes...): How can I add Text, shapes to ToolPicker on my canvas ? struct MyCanvas: UIViewRepresentable { var canvasView: PKCanvasView …
Clément Tengip
  • 618
  • 6
  • 19
7
votes
2 answers

zoomable PKCanvasView with underlaying background image

I like to make PKCanvasView to be scrollable and zoomable with underlay image. It seems it is okay to make it scrollable and zoomable without underlaying background image. But to make it with underlaying image I don’t know how to make it…
Kaz Yoshikawa
  • 1,577
  • 1
  • 18
  • 26
6
votes
1 answer

Overlaying PKCanvasView on top of WKWebView

I'm trying to integrate Apple Pencil with a WKWebView. Desired behavior: Using pencil allows you to draw on the webpage with all the fancy PencilKit integrations (PKToolPicker, etc) Using fingers allows you to scroll through the webpage, and the…
Amir Omidi
  • 329
  • 1
  • 11
6
votes
0 answers

How to rescale PKDrawing in SwiftUI on screen rotation?

Im currently making an app usig PencilKit and SwiftUI. If the screen is rotated, the canvas (and the drawing) should be rescaled acordingly. I do this with the Geometry reader and calculating the size. NavigationView { …
Jannik
  • 61
  • 3
6
votes
1 answer

How to use PKToolPicker with PKCanvasView in SwiftUI

Currently, I am able to have a separate PKCanvasView and a PKToolPicker that is shown when a button is tapped on. However, the tool is not being transferred between the picker and the canvas view. Does anyone have any idea how to link the two such…
HeySaiK
  • 480
  • 1
  • 6
  • 17
6
votes
2 answers

How to set constant width of strokes from PKInkingTool in PencilKit

When drawing on screen using finger/pencil with the PencilKit API, I would like to set the width of strokes to be a constant. Currently, the width setting in say PKInkingTool only sets the baseline width when drawing with finger or pencil, and the…
Venkat
  • 446
  • 1
  • 4
  • 15
5
votes
0 answers

Does Apple's PencilKit support that Drawing and Holding to Create Perfect Shapes, if not, how to implement it?

What I want: The picture is from Notes app in iPad. The blurred red path I drew with Apple Pencil. Holding and then the perfect circle shape generated. I checked the Apple's developer documentation about PencilKit. It seems no related API to…
Bernard
  • 89
  • 4
1
2 3
9 10