I used following open source code to detect faces in an image.
https://github.com/zhangao0086/iOS-CoreImage-Swift/tree/master/FaceDetection
I select image from camera but when I again want to select a new picture, I want the previous rectangles to be removed since I will run same API again on new image. Although my code finds new faces in new image, but it doesnt override previous UIImage.
How do I remove the previously drawn rectangles?
If you're using this view controller you can say something like:
for view in self.imageView.subviews
{
view.removeFromSuperview()
}