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
0
votes
2 answers

Custom PKDrawing file

can you please please help me how can I create my own, custom PKDrawing file? I see that in the code of the sample app are using PKDrawing file. I would like to create my own PKDrawing file, with lines or curves. Any tips on how to approach…
stackTry
  • 1
  • 1
0
votes
1 answer

How can I fix pencilKit toolbar?

I am trying to make a drawing app for IOS 15.5 using pencilKit. I can draw on screen but when i want to change tool using toolPicker it is not actually changing(it keeps drawing with default one) here is my code import UIKit import PencilKit class…
Mixturka
  • 3
  • 1
0
votes
1 answer

How do I get the currently selected pencil kit color?

I have the following pencil kit setup: class PencilKitVC: UIViewController { // MARK: - Views private let canvasView = PKCanvasView() private let toolPicker = PKToolPicker() // MARK: - View Lifecycle override func…
Kex
  • 8,023
  • 9
  • 56
  • 129
0
votes
1 answer

How do I pan PKCanvasView?

I have a PKCanvasView setup as follows: class PencilKitVC: UIViewController { // MARK: - Views private let canvasView = PKCanvasView() private let toolPicker = PKToolPicker() // MARK: - View Lifecycle override func…
Kex
  • 8,023
  • 9
  • 56
  • 129
0
votes
1 answer

PKCanvasView / PKDrawing get strokes selected by lasso

When using PKCanvasView with standard drawing tools (PKToolPicker), there is a lasso tool available. It is possible to select existing pencil strokes and modify them. On the other hand, through PKDrawing it is possible to access all strokes…
Kaven
  • 147
  • 1
  • 11
0
votes
1 answer

Paste Image in PencilKit Canvas

As I am quite new to SwiftUI Programming I want to ask what the best way is to paste an Image into a PKCanvasView. I do not expect to get any code but maybe some directions what are possible ways to achieve my goal. Unfortunately the only tutorials…
jakob witsch
  • 157
  • 1
  • 1
  • 12
0
votes
1 answer

Find similarities as a percentage between two UIImage

I'm trying to build an app to find similarities as a percentage between two UIImage, the app captures the user stroke pencil and converts it to UIImage then finds similarity pixel by pixel with the image stored on the app. I found code that finds…
NOR
  • 1
  • 1
0
votes
1 answer

Storing a PKDrawing object to Core Data

I am trying to add Apple Pencil support to my mind mapping app. I already use Core Data within my app for data persistence which all works fine without any bugs. I have my Apple Pencil features working fine but I'm having trouble storing the Apple…
Badger
  • 31
  • 4
0
votes
0 answers

How do I save PKDrawing in Swift with white background

I am using PencilKit framework to capture a user's drawing and save it. I want to save a user input drawing with a white background. The image should look like this, where the canvas background I have is white. I use the UIImage api from…
calveeen
  • 621
  • 2
  • 10
  • 28
0
votes
1 answer

Mac Catalyst version of working iOS App gets dyld crash

I need to run a version of an existing iOS app in MacOS (10.15.7). The app uses PencilKit and runs well in iOS 14. Compiling with Xcode 12.3 Trying to run in Catalina, the App crashes during dynamic framework loading before arriving at the app's…
BlueskyMed
  • 765
  • 7
  • 24
0
votes
2 answers

SWIFTUI: Draw on a PDF

so I'm building an app right now where I want to draw on a PDF - just like a signature. The app is build in Swift and I'm using SwiftU, PencilKit, PDFKit and WebKit. I already can show the PDF and draw on view. If I use my PDFView as a background…
SirDeLight
  • 43
  • 1
  • 6
0
votes
1 answer

Does anyone have a good way to render PKDrawing to PDF clearly?

I'm trying to share my PKDrawing results via PDF file for email or print. I'm creating the PDF using 2 other PDF files plus the PKDrawing on the top layer. The 2 PDF layers look clear. The PKDrawing however is somewhat grainy, especially compared to…
David Peat
  • 244
  • 2
  • 5
0
votes
1 answer

How to set a SwiftUI View as a first responder manually?

I'm building an app using mostly SwiftUI, but I have to use a UIKit ViewController to interface with PencilKit. I'm using UIViewControllerRepresentable to interface between them. So I have a ViewController which I'm using to set up the PencilKit…
Hamster
  • 133
  • 3
  • 12
0
votes
0 answers

UICollectionView not release memory after select a new button

I'm working on a note app that has a collection view of notes, and taping each cell will lead the user to different note. In the case of my app, each note is essentially a PKCavnasView that inherent from ScrollView. What I found is that when user…
0
votes
1 answer

How to Get the Coordinates of a Touch Gesture on a PKCanvasView using PencilKit? Swift 5 & Xcode 11

NOTE that I looked a lot everywhere but couldn't find a solution. Using the Storyboard, I have a ViewController, with a View (UIView) and a Subview (PKCanvasView) where I want to use PencilKit to draw on the latter. _ My objectives are: Draw only…
1 2 3
9
10