How can I make a canvas class that paints an image?

Hello I am starting with swift, I want to make a mobile app that has a canvas and two buttons where the user can draw an image from the gallery or the camera, in addition to that I want to draw geometric figures in specific coordinates of the canvas, someone can help me with some examples or indicate some libraries that help me with this objective, any help will be well received
It is relatively simple.

If you work with interface builder :
  • in IB, create an ImageView and the 2 buttons

  • define an IBOutlet for the UIImageView

Code Block
@IBOutlet weak var imageView: UIImageView!
  • store the image in Xcode

  • the IBAction for the button will load the image:

Code Block
        imageView.image = UIImage(named: "Some Image") // One of the stored images)

How can I make a canvas class that paints an image?
 
 
Q