How to print layer cover image picker photo when taking photos

My code below prints a image over the image picker buts its not retained. Then its put on a image view and another buttton its selected to print the image over. I want to combine the two actions into one actions. Take the photo and place it in the image view while placing the photo over it.

                   @IBAction func takePhoto(_ sender: UIButton) {
    imagePicker =  UIImagePickerController()
    imagePicker.delegate = self
    imagePicker.sourceType = .camera
    present(imagePicker, animated: true, completion: nil)
    let mainView = UIView.init(frame: CGRect.init(x: 0, y: 0, width: self.view.frame.size.width, height: self.view.frame.size.height-150))
    let frame  = CGRect.init(x: 0, y: 0, width: self.view.frame.size.width, height: 120)
    let blockView = UIImageView.init(frame: frame)
    blockView.contentMode = .scaleAspectFit
    blockView.image   = UIImage(named: "dd")
    mainView.addSubview(blockView)
   }
   @IBAction func Mask(_ sender: Any) {
   let heart:UIImage = UIImage(named: "dd")!
 let left:UIImage = imageTake.image!
 let newSize2 = CGSize(width: left.size.width, height: left.size.height)
 UIGraphicsBeginImageContextWithOptions(newSize2, false, left.scale)
 left.draw(in: CGRect(x: 0,y: 0,width: newSize2.width,height:   newSize2.height), blendMode:CGBlendMode.normal, alpha:1.0)
 heart.draw(in: CGRect(x: 0,y: 0,width: newSize2.width,height:   newSize2.height), blendMode:CGBlendMode.normal, alpha:1.0)
 let newImage:UIImage = UIGraphicsGetImageFromCurrentImageContext()!
 UIGraphicsEndImageContext()
imageTake.image = newImage
}