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 lines on a PKCanvasView
?
You can now
yourPKCanvasView.drawing = PKDrawing(strokes: yourPKStrokes)
Full example: https://developer.apple.com/documentation/pencilkit/inspecting_modifying_and_constructing_pencilkit_drawings
If you're looking to create the drawing 100% programmatically, from raw CGPoints, instead of from a predefined asset like in Apple's examples, see https://stackoverflow.com/a/70274331/4075379
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With