From ee75ab4087f22147d81ccdb9aa8210cf86612483 Mon Sep 17 00:00:00 2001 From: KyXu Date: Sun, 16 Oct 2016 17:58:33 +0800 Subject: [PATCH] CropViewController bug fix --- CropViewController/CropViewController.swift | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/CropViewController/CropViewController.swift b/CropViewController/CropViewController.swift index 74a5ae4..a98b19b 100644 --- a/CropViewController/CropViewController.swift +++ b/CropViewController/CropViewController.swift @@ -133,15 +133,11 @@ open class CropViewController: UIViewController { } func done(_ sender: UIBarButtonItem) { - if let image = cropView?.croppedImage { - delegate?.cropViewController(self, didFinishCroppingImage: image) - guard let rotation = cropView?.rotation else { - return - } - guard let rect = cropView?.zoomedCropRect() else { - return - } + guard let image = cropView?.croppedImage else { return } + if let rotation = cropView?.rotation, let rect = cropView?.zoomedCropRect() { delegate?.cropViewController(self, didFinishCroppingImage: image, transform: rotation, cropRect: rect) + }else { + delegate?.cropViewController(self, didFinishCroppingImage: image) } }