The default crop function in iPhone photo album
Does any one know how to i
func cropImageZero(_ completionHandler: (_ img: UIImage)->()){
let image = UIImage(named: "name")
let rect = CGRect(x: 0, y: y, width: width, height: height)
let cgImage = image?.cgImage!.cropping(to: rect)
let imageNew = UIImage(cgImage: cgImage!)
completionHandler(imageNew)
}
Bonnie's answer is useful