Skip to content

Commit

Permalink
Merge pull request #563 from noppefoxwolf/feature/actor-isolated
Browse files Browse the repository at this point in the history
Support `actor isolated` and `existential any`.
  • Loading branch information
TimOliver authored Apr 6, 2024
2 parents 8f3fc96 + 51be6bd commit 4f9cee3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.3
// swift-tools-version:5.9

import PackageDescription

Expand Down
14 changes: 7 additions & 7 deletions Swift/CropViewController/CropViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public typealias CropViewCroppingStyle = TOCropViewCroppingStyle
/// @name Delegate
// ------------------------------------------------

@objc public protocol CropViewControllerDelegate: NSObjectProtocol {
@MainActor @objc public protocol CropViewControllerDelegate: NSObjectProtocol {
/**
Called when the user has committed the crop action, and provides
just the cropping rectangle.
Expand Down Expand Up @@ -108,7 +108,7 @@ open class CropViewController: UIViewController, TOCropViewControllerDelegate {
The view controller's delegate that will receive the resulting
cropped image, as well as crop information.
*/
public weak var delegate: CropViewControllerDelegate? {
public weak var delegate: (any CropViewControllerDelegate)? {
didSet { self.setUpDelegateHandlers() }
}

Expand Down Expand Up @@ -665,7 +665,7 @@ extension CropViewController {
fileprivate func setUpCropController() {
modalPresentationStyle = .fullScreen
addChild(toCropViewController)
transitioningDelegate = (toCropViewController as! UIViewControllerTransitioningDelegate)
transitioningDelegate = (toCropViewController as! (any UIViewControllerTransitioningDelegate))
toCropViewController.delegate = self
toCropViewController.didMove(toParent: self)
}
Expand All @@ -679,28 +679,28 @@ extension CropViewController {
return
}

if delegate.responds(to: #selector(CropViewControllerDelegate.cropViewController(_:didCropImageToRect:angle:))) {
if delegate.responds(to: #selector((any CropViewControllerDelegate).cropViewController(_:didCropImageToRect:angle:))) {
self.onDidCropImageToRect = {[weak self] rect, angle in
guard let strongSelf = self else { return }
delegate.cropViewController!(strongSelf, didCropImageToRect: rect, angle: angle)
}
}

if delegate.responds(to: #selector(CropViewControllerDelegate.cropViewController(_:didCropToImage:withRect:angle:))) {
if delegate.responds(to: #selector((any CropViewControllerDelegate).cropViewController(_:didCropToImage:withRect:angle:))) {
self.onDidCropToRect = {[weak self] image, rect, angle in
guard let strongSelf = self else { return }
delegate.cropViewController!(strongSelf, didCropToImage: image, withRect: rect, angle: angle)
}
}

if delegate.responds(to: #selector(CropViewControllerDelegate.cropViewController(_:didCropToCircularImage:withRect:angle:))) {
if delegate.responds(to: #selector((any CropViewControllerDelegate).cropViewController(_:didCropToCircularImage:withRect:angle:))) {
self.onDidCropToCircleImage = {[weak self] image, rect, angle in
guard let strongSelf = self else { return }
delegate.cropViewController!(strongSelf, didCropToCircularImage: image, withRect: rect, angle: angle)
}
}

if delegate.responds(to: #selector(CropViewControllerDelegate.cropViewController(_:didFinishCancelled:))) {
if delegate.responds(to: #selector((any CropViewControllerDelegate).cropViewController(_:didFinishCancelled:))) {
self.onDidFinishCancelled = {[weak self] finished in
guard let strongSelf = self else { return }
delegate.cropViewController!(strongSelf, didFinishCancelled: finished)
Expand Down

0 comments on commit 4f9cee3

Please sign in to comment.