diff --git a/Example/CustomizedCropToolbar.swift b/Example/CustomizedCropToolbar.swift index fcc4d499..e24fae6f 100644 --- a/Example/CustomizedCropToolbar.swift +++ b/Example/CustomizedCropToolbar.swift @@ -88,15 +88,15 @@ class CustomizedCropToolbar: UIView, CropToolbarProtocol { } @objc private func crop() { - cropToolbarDelegate?.didSelectCrop() + cropToolbarDelegate?.didSelectCrop(self) } @objc private func cancel() { - cropToolbarDelegate?.didSelectCancel() + cropToolbarDelegate?.didSelectCancel(self) } @objc private func showRatioList() { - cropToolbarDelegate?.didSelectSetRatio() + cropToolbarDelegate?.didSelectSetRatio(self) } private func createOptionButton(withTitle title: String?, andAction action: Selector) -> UIButton { diff --git a/Example/CustomizedCropToolbarWithoutList.swift b/Example/CustomizedCropToolbarWithoutList.swift index 080b86f7..5f41d831 100644 --- a/Example/CustomizedCropToolbarWithoutList.swift +++ b/Example/CustomizedCropToolbarWithoutList.swift @@ -92,19 +92,19 @@ class CustomizedCropToolbarWithoutList: UIView, CropToolbarProtocol { } @objc private func crop() { - cropToolbarDelegate?.didSelectCrop() + cropToolbarDelegate?.didSelectCrop(self) } @objc private func cancel() { - cropToolbarDelegate?.didSelectCancel() + cropToolbarDelegate?.didSelectCancel(self) } @objc private func setPortraitRatio() { - cropToolbarDelegate?.didSelectRatio(ratio: 9 / 16) + cropToolbarDelegate?.didSelectRatio(self, ratio: 9 / 16) } @objc private func setLandscapeRatio() { - cropToolbarDelegate?.didSelectRatio(ratio: 16 / 9) + cropToolbarDelegate?.didSelectRatio(self, ratio: 16 / 9) } private func createOptionButton(withTitle title: String?, andAction action: Selector) -> UIButton { diff --git a/Example/MyNavigationCropToolbar.swift b/Example/MyNavigationCropToolbar.swift index c50e64a1..38544171 100644 --- a/Example/MyNavigationCropToolbar.swift +++ b/Example/MyNavigationCropToolbar.swift @@ -45,14 +45,14 @@ class MyNavigationCropToolbar: UIView, CropToolbarProtocol { } @objc func crop() { - cropToolbarDelegate?.didSelectCrop() + cropToolbarDelegate?.didSelectCrop(self) } @objc func cancel() { - cropToolbarDelegate?.didSelectCancel() + cropToolbarDelegate?.didSelectCancel(self) } @objc func rotate() { - cropToolbarDelegate?.didSelectClockwiseRotate() + cropToolbarDelegate?.didSelectClockwiseRotate(self) } } diff --git a/Sources/Mantis/CropViewController/CropToolbar.swift b/Sources/Mantis/CropViewController/CropToolbar.swift index cac34323..ebb06db7 100644 --- a/Sources/Mantis/CropViewController/CropToolbar.swift +++ b/Sources/Mantis/CropViewController/CropToolbar.swift @@ -203,39 +203,39 @@ public class CropToolbar: UIView, CropToolbarProtocol { // Objc functions extension CropToolbar { @objc private func cancel() { - cropToolbarDelegate?.didSelectCancel() + cropToolbarDelegate?.didSelectCancel(self) } @objc private func setRatio() { - cropToolbarDelegate?.didSelectSetRatio() + cropToolbarDelegate?.didSelectSetRatio(self) } @objc private func reset(_ sender: Any) { - cropToolbarDelegate?.didSelectReset() + cropToolbarDelegate?.didSelectReset(self) } @objc private func counterClockwiseRotate(_ sender: Any) { - cropToolbarDelegate?.didSelectCounterClockwiseRotate() + cropToolbarDelegate?.didSelectCounterClockwiseRotate(self) } @objc private func clockwiseRotate(_ sender: Any) { - cropToolbarDelegate?.didSelectClockwiseRotate() + cropToolbarDelegate?.didSelectClockwiseRotate(self) } @objc private func alterCropper90Degree(_ sender: Any) { - cropToolbarDelegate?.didSelectAlterCropper90Degree() + cropToolbarDelegate?.didSelectAlterCropper90Degree(self) } @objc private func horizontallyFlip(_ sender: Any) { - cropToolbarDelegate?.didSelectHorizontallyFlip() + cropToolbarDelegate?.didSelectHorizontallyFlip(self) } @objc private func verticallyFlip(_ sender: Any) { - cropToolbarDelegate?.didSelectVerticallyFlip() + cropToolbarDelegate?.didSelectVerticallyFlip(self) } @objc private func crop(_ sender: Any) { - cropToolbarDelegate?.didSelectCrop() + cropToolbarDelegate?.didSelectCrop(self) } } diff --git a/Sources/Mantis/CropViewController/CropToolbarProtocol.swift b/Sources/Mantis/CropViewController/CropToolbarProtocol.swift index b93b0c7b..8777b79b 100644 --- a/Sources/Mantis/CropViewController/CropToolbarProtocol.swift +++ b/Sources/Mantis/CropViewController/CropToolbarProtocol.swift @@ -11,16 +11,16 @@ import UIKit Inside Mantis, CropViewController implements all delegate methods */ public protocol CropToolbarDelegate: AnyObject { - func didSelectCancel() - func didSelectCrop() - func didSelectCounterClockwiseRotate() - func didSelectClockwiseRotate() - func didSelectReset() - func didSelectSetRatio() - func didSelectRatio(ratio: Double) - func didSelectAlterCropper90Degree() - func didSelectHorizontallyFlip() - func didSelectVerticallyFlip() + func didSelectCancel(_ cropToolbar: CropToolbarProtocol) + func didSelectCrop(_ cropToolbar: CropToolbarProtocol) + func didSelectCounterClockwiseRotate(_ cropToolbar: CropToolbarProtocol) + func didSelectClockwiseRotate(_ cropToolbar: CropToolbarProtocol) + func didSelectReset(_ cropToolbar: CropToolbarProtocol) + func didSelectSetRatio(_ cropToolbar: CropToolbarProtocol) + func didSelectRatio(_ cropToolbar: CropToolbarProtocol, ratio: Double) + func didSelectAlterCropper90Degree(_ cropToolbar: CropToolbarProtocol) + func didSelectHorizontallyFlip(_ cropToolbar: CropToolbarProtocol) + func didSelectVerticallyFlip(_ cropToolbar: CropToolbarProtocol) } public protocol CropToolbarIconProvider: AnyObject { diff --git a/Sources/Mantis/CropViewController/CropViewController.swift b/Sources/Mantis/CropViewController/CropViewController.swift index bebcee0e..5142d308 100644 --- a/Sources/Mantis/CropViewController/CropViewController.swift +++ b/Sources/Mantis/CropViewController/CropViewController.swift @@ -525,43 +525,43 @@ extension CropViewController: CropViewDelegate { } extension CropViewController: CropToolbarDelegate { - public func didSelectHorizontallyFlip() { + public func didSelectHorizontallyFlip(_ cropToolbar: CropToolbarProtocol) { handleHorizontallyFlip() } - public func didSelectVerticallyFlip() { + public func didSelectVerticallyFlip(_ cropToolbar: CropToolbarProtocol) { handleVerticallyFlip() } - public func didSelectCancel() { + public func didSelectCancel(_ cropToolbar: CropToolbarProtocol) { handleCancel() } - public func didSelectCrop() { + public func didSelectCrop(_ cropToolbar: CropToolbarProtocol) { handleCrop() } - public func didSelectCounterClockwiseRotate() { + public func didSelectCounterClockwiseRotate(_ cropToolbar: CropToolbarProtocol) { handleRotate(rotateAngle: -CGFloat.pi / 2) } - public func didSelectClockwiseRotate() { + public func didSelectClockwiseRotate(_ cropToolbar: CropToolbarProtocol) { handleRotate(rotateAngle: CGFloat.pi / 2) } - public func didSelectReset() { + public func didSelectReset(_ cropToolbar: CropToolbarProtocol) { handleReset() } - public func didSelectSetRatio() { + public func didSelectSetRatio(_ cropToolbar: CropToolbarProtocol) { handleSetRatio() } - public func didSelectRatio(ratio: Double) { + public func didSelectRatio(_ cropToolbar: CropToolbarProtocol, ratio: Double) { setFixedRatio(ratio) } - public func didSelectAlterCropper90Degree() { + public func didSelectAlterCropper90Degree(_ cropToolbar: CropToolbarProtocol) { handleAlterCropper90Degree() } }