Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support actor isolated and existential any. #563

Merged
merged 4 commits into from
Apr 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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