I gave myself an exercise to learn Swift, based on an example I found on the Apple Swift website :

As you can see there is a river and several points in it right in the middle, forming a path. So I started looking for a similar image of rivers on the Internet, and I created an Xcode playground. This is what I have now:

So basically I have a UIView with a subview consisting of the river image I found and the points with UIBezierPath .
My first question is: is this the right way to draw on a UIView? I mean using UIBezierPath . And my second question: how to draw a point with the exact coordinate inside the UIView ? ( UIBezierPath or everything else?)
To be more precise, I would like to make an algorithm so that the program recognizes the image and draws a line based on the color of the pixel with dots from the beginning to the end of the river, passing the middle between them.
source share