Reputation: 1039
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
?
Upvotes: 9
Views: 2049
Reputation: 1420
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
Upvotes: 1
Reputation: 41
You can now
yourPKCanvasView.drawing = PKDrawing(strokes: yourPKStrokes)
Full example: https://developer.apple.com/documentation/pencilkit/inspecting_modifying_and_constructing_pencilkit_drawings
Upvotes: 3