Posts

Post not yet marked as solved
2 Replies
1.2k Views
Forgive me if this is the wrong place for this question, I don't see PencilKit anyhere on the forum listings and I don't really see anything that it approximates either. Since I'm hoping to use it along with MapKit, I figure this might be a reasonable place to start!I'm trying to figure out how to layer a PKCanvasView on top of a MKMapView such that I can draw on the map. That's the long game. But I've run into some limitations and not certain how to approach them. Mainly, I am not sure how to, or if it's even possible to, make PKCanvasView "wrap around" like MKMapView does. PKCanvasView is a UIScrollView, and the way folks seem to do that is using the "8 1 2 3 ... 8 1" method. Doing that with a bunch of PKCanvasViews to simulate wrapping around seems like a pain, but also seems fairly reasonable at the same time. However, I can't seem to make pencil strokes cross into neighboring PKCanvasViews. As a quick experiment I made a VStack (swiftui) with 2 PKCanvasView UIViewRepresentables which I can draw on separately, but when I get to the edge of the canvas, the line stops. When I cross back without lifting the pencil, the line resumes. This also happens on the other view. By default there seems to be a gap between the canvases so I thought maybe that was a problem, but eliminating the gap didn't seem to help.Has anyone tried to do this tiling of PKCanvasViews and succeeded? Or even just implemented a "draw on top of a map with the apple pencil" and could share some pointers or maybe even code?The WWDC19 221 slides have "tiling" on the tagcloud slide, but searching isn't coming up with much, and the documentation doesn't mention anything about it.I have a feeling this is not currently possible (and may never be possible with PencilKit) so I'll probably have to roll my own drawing interface, but I'd like to at least give this a good heave-ho before I give up on it.Thanks!
Posted
by kitchen.
Last updated
.