Questions tagged [pkcanvasview]

This tag doesn't currently have an excerpt. Help contribute by writing one

14 questions
3
votes
0 answers

How to prevent scrolling when interacting with a PKCanvasView in a Scroll view in SwiftUI?

I have a UIViewRepresentable that represents a PKCanvasView. struct PKCanvasRepresentable : UIViewRepresentable { @Binding var canvas: PKCanvasView func makeUIView(context: Context) -> PKCanvasView { canvas.tool =…
Gilby
  • 29
  • 3
3
votes
0 answers

Scrollable PKCanvasView with SwiftUI subview

I found this question on stackoverflow with this source code as possible solution. How can I use a SwiftUI view instead of a UIImageView as underlayView? I tried to replace the UIImageView with a UIView and converted my SwiftUI view with a…
halloduda
  • 31
  • 2
2
votes
1 answer

How to use PKCanvasView functionality without PKToolPicker?

I want to use PKCanvasView functionality without PKToolPicker. As soon as I set PKToolPicker visibility to false PKCanvasView draws noting. What is the way to hide PKToolPicker and use PKCanvasView? Here is the code which I am using: struct…
Ramis
  • 13,985
  • 7
  • 81
  • 100
1
vote
2 answers

Swiftui UIViewRepresentable - How to update PKCanvasView image when imageData source is changed on user action

I am creating a SwiftUI app with PencilKit & UIViewRepresentable. I am adding a image coming from server on top of the PKCanvasView. Code works fine when I click on a image and open a canvas view then close it and reopen it. But I am not able load a…
0
votes
1 answer

Select CanvasView tools over many files

I have four files. In PKCanvasRepresentation.swift I only initialise the canvas view. In CanvasView.swift I use the initialisation and want to assign the individual tools through the given selection from NoteToolbarView.swift. In NoteToolbarView I…
Joschi
  • 13
  • 3
0
votes
0 answers

Prevent PKCanvasView background from turning white while drawing

I have a PKCanvasView in my SwiftUI app using a UIViewRepresentable. I want the canvas content (PKDrawing) to have a white background and the rest of the view a gray background. The canvas is zoomable. Here is the relevant bits of my code: import…
alionthego
  • 8,508
  • 9
  • 52
  • 125
0
votes
1 answer

Real-time drawing synchronization between PKCanvasView on iPad and external screen

Situation: I'm developing an iPad app using SwiftUI, and I have an external screen connected to the iPad. In my app, I want to provide a drawing feature using PKCanvasView. The goal is to allow users to draw on the iPad screen and have the drawing…
wades
  • 250
  • 2
  • 10
0
votes
2 answers

PKCanvas mysteriously returns original drawing, how?

MRE I've spent so many hours trying to figure out whats happening but I cant figure it out struct ContentView: View { @State private var canvasView = PKCanvasView() @State private var rendition = PKDrawing() func save() { …
erotsppa
  • 14,248
  • 33
  • 123
  • 181
0
votes
0 answers

How do I blend PKCanvasView and a subview inside UIViewRepresentable?

I have a regular PKCanvasView implemented inside a UIViewRepresentable in SwiftUI. struct Canvas2View: UIViewRepresentable { @Binding var canvasView: MyPKCanvasView @Binding var toolPickerIsActive: Bool private let toolPicker =…
erotsppa
  • 14,248
  • 33
  • 123
  • 181
0
votes
0 answers

Find the ID of selected strokes by PKLassoTool

I'm trying to create an iPad App to draw on a canvas with polygon detection and I'm using PencilKit. My problem is that when I select a stroke with PKLassoTool I need to find the ID of that stroke in the canvas in order to custom modify it. Is there…
0
votes
0 answers

Disable "Undo added strokes" popup in Swift and PKCanvasView

Currently if a user has created a stroke and shakes with the Apple Pencil and then shakes the iPad, a pop up saying 'Undo Added strokes" pops up. We want to remove this from the app for pencil kit. Currently, Apple's documentation suggests that we…
Osian
  • 171
  • 1
  • 14
0
votes
0 answers

SwiftUI: Cannot set 'zoomScale' of an PKCanvasView()

I want to set the Zoom scale of my PKCanvasView() I tried adding this function: func setCanvasZoom() { canvasView.zoomScale = 2.0 print("CanvasView: \(canvasView.zoomScale)") } But that function always throws 1.0 in the console... I am…
yama_HD
  • 480
  • 1
  • 4
  • 14
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
-1
votes
1 answer

SWIFTUI....Is it possible with PKCanvasView

I have created a drawing app. I have the canvas and tools working correctly. I have also added the ability to insert some predefined shapes into the canvas. My question or where I am running into difficulty is when you use the PKLassoTool() I am…