@@ -43,7 +43,7 @@ public typealias CropViewCroppingStyle = TOCropViewCroppingStyle
43
43
/// @name Delegate
44
44
// ------------------------------------------------
45
45
46
- @objc public protocol CropViewControllerDelegate : NSObjectProtocol {
46
+ @MainActor @ objc public protocol CropViewControllerDelegate : NSObjectProtocol {
47
47
/**
48
48
Called when the user has committed the crop action, and provides
49
49
just the cropping rectangle.
@@ -108,7 +108,7 @@ open class CropViewController: UIViewController, TOCropViewControllerDelegate {
108
108
The view controller's delegate that will receive the resulting
109
109
cropped image, as well as crop information.
110
110
*/
111
- public weak var delegate : CropViewControllerDelegate ? {
111
+ public weak var delegate : ( any CropViewControllerDelegate ) ? {
112
112
didSet { self . setUpDelegateHandlers ( ) }
113
113
}
114
114
@@ -665,7 +665,7 @@ extension CropViewController {
665
665
fileprivate func setUpCropController( ) {
666
666
modalPresentationStyle = . fullScreen
667
667
addChild ( toCropViewController)
668
- transitioningDelegate = ( toCropViewController as! UIViewControllerTransitioningDelegate )
668
+ transitioningDelegate = ( toCropViewController as! ( any UIViewControllerTransitioningDelegate ) )
669
669
toCropViewController. delegate = self
670
670
toCropViewController. didMove ( toParent: self )
671
671
}
@@ -679,28 +679,28 @@ extension CropViewController {
679
679
return
680
680
}
681
681
682
- if delegate. responds ( to: #selector( CropViewControllerDelegate . cropViewController ( _: didCropImageToRect: angle: ) ) ) {
682
+ if delegate. responds ( to: #selector( ( any CropViewControllerDelegate ) . cropViewController ( _: didCropImageToRect: angle: ) ) ) {
683
683
self . onDidCropImageToRect = { [ weak self] rect, angle in
684
684
guard let strongSelf = self else { return }
685
685
delegate. cropViewController!( strongSelf, didCropImageToRect: rect, angle: angle)
686
686
}
687
687
}
688
688
689
- if delegate. responds ( to: #selector( CropViewControllerDelegate . cropViewController ( _: didCropToImage: withRect: angle: ) ) ) {
689
+ if delegate. responds ( to: #selector( ( any CropViewControllerDelegate ) . cropViewController ( _: didCropToImage: withRect: angle: ) ) ) {
690
690
self . onDidCropToRect = { [ weak self] image, rect, angle in
691
691
guard let strongSelf = self else { return }
692
692
delegate. cropViewController!( strongSelf, didCropToImage: image, withRect: rect, angle: angle)
693
693
}
694
694
}
695
695
696
- if delegate. responds ( to: #selector( CropViewControllerDelegate . cropViewController ( _: didCropToCircularImage: withRect: angle: ) ) ) {
696
+ if delegate. responds ( to: #selector( ( any CropViewControllerDelegate ) . cropViewController ( _: didCropToCircularImage: withRect: angle: ) ) ) {
697
697
self . onDidCropToCircleImage = { [ weak self] image, rect, angle in
698
698
guard let strongSelf = self else { return }
699
699
delegate. cropViewController!( strongSelf, didCropToCircularImage: image, withRect: rect, angle: angle)
700
700
}
701
701
}
702
702
703
- if delegate. responds ( to: #selector( CropViewControllerDelegate . cropViewController ( _: didFinishCancelled: ) ) ) {
703
+ if delegate. responds ( to: #selector( ( any CropViewControllerDelegate ) . cropViewController ( _: didFinishCancelled: ) ) ) {
704
704
self . onDidFinishCancelled = { [ weak self] finished in
705
705
guard let strongSelf = self else { return }
706
706
delegate. cropViewController!( strongSelf, didFinishCancelled: finished)
0 commit comments