title: Trying to add circles onto image from Photo Library iOS
body: <p>I'm building part of my app where you can:</p>
  
  <ol>
  <li>upload photos</li>
  <li>subsequently add circles onto these photos</li>
  <li>save these photos with the circles on them</li>
  </ol>
  
  <p>I'm able to do step 1, but need help for step 2 and 3.</p>
  
  <p>Here is the code I have so far. Please let me know what's wrong.</p>
  
  <pre><code>@IBAction func openPhotoLibraryButton(sender: AnyObject) {
      if UIImagePickerController.isSourceTypeAvailable(.photoLibrary) {
          let imagePicker = UIImagePickerController()
          imagePicker.delegate = self
          imagePicker.sourceType = .photoLibrary;
          imagePicker.allowsEditing = true
          self.present(imagePicker, animated: true, completion: nil)
      }
  }
  
  func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
      let image = info[UIImagePickerControllerOriginalImage] as! UIImage
      imagePicked.image = image
      dismiss(animated:true, completion: nil)
  </code></pre>
  
  <p>This is the part where I have trouble adding the circles into the image picked:</p>
  
  <pre><code>func DrawOnImage(imagePicked: UIImage) -&gt; UIImage {
      UIGraphicsBeginImageContext(imagePicked.size)
  
      imagePicked.draw(at: CGPoint.zero)
  
      let context = UIGraphicsGetCurrentContext()!
      context.setStrokeColor(UIColor.green.cgColor)
      context.setAlpha(1.0)
      context.setLineWidth(10.0)
      context.addEllipse(in: CGRect(x: 100, y: 100, width: 100, height: 100))
      context.drawPath(using: .stroke)
  
      let myImage = UIGraphicsGetImageFromCurrentImageContext()
      UIGraphicsEndImageContext()
  
      return myImage!
  }
  </code></pre>
  
  <p>The trouble I face is that the circles appear all over the screen and is not bounded onto the image. I want to export the image with the marked circles. </p>