From 11c56e4fb39486054a2734e697505ac3b94bd67b Mon Sep 17 00:00:00 2001 From: Denys Telezhkin Date: Thu, 2 Dec 2021 16:58:36 +0200 Subject: [PATCH] Remove wrappers for removed delegate method. --- CHANGELOG.md | 4 ++++ .../DTCollectionViewDelegate.swift | 9 +-------- .../DTCollectionViewManager+Delegate.swift | 9 --------- .../DTCollectionViewManager.swift | 1 - Sources/Tests/ReactingToEventsTestCase.swift | 15 +-------------- 5 files changed, 6 insertions(+), 32 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d0fefa0..4956a57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ All notable changes to this project will be documented in this file. * Wrappers for `collectionView:selectionFollowsFocusForItemAtIndexPath:` delegate method. * Wrappers for iOS 15 `UICollectionViewDelegate.collectionView(_:targetIndexPathForMoveOfItemFromOriginalIndexPath:atCurrentIndexPath:toProposedIndexPath:)` delegate method. +### Removed + +* Wrappers for `collectionView:willCommitMenuWithAnimator` delegate method, that was only briefly available in Xcode 12, and was removed by Apple in one of Xcode 12 releases. + ### Deprecated * `targetIndexPathForMovingItem` deprecated on iOS / tvOS 15 and higher, because delegate method `collectionView:targetIndexPathForMoveFromItemAt:toProposedIndexPath:` was deprecated in favor of newer method. diff --git a/Sources/DTCollectionViewManager/DTCollectionViewDelegate.swift b/Sources/DTCollectionViewManager/DTCollectionViewDelegate.swift index 860b884..ada0522 100644 --- a/Sources/DTCollectionViewManager/DTCollectionViewDelegate.swift +++ b/Sources/DTCollectionViewManager/DTCollectionViewDelegate.swift @@ -325,14 +325,7 @@ open class DTCollectionViewDelegate: DTCollectionViewDelegateWrapper, UICollecti } return (delegate as? UICollectionViewDelegate)?.collectionView?(collectionView, previewForDismissingContextMenuWithConfiguration: configuration) } - #if compiler(<5.1.2) - @available(iOS 13.0, *) - /// Implementation for `UICollectionViewDelegate` protocol - open func collectionView(_ collectionView: UICollectionView, willCommitMenuWithAnimator animator: UIContextMenuInteractionCommitAnimating) { - _ = performNonCellReaction(.willCommitMenuWithAnimator, argument: animator) - (delegate as? UICollectionViewDelegate)?.collectionView?(collectionView, willCommitMenuWithAnimator: animator) - } - #endif + #endif #if compiler(>=5.5) && os(iOS) diff --git a/Sources/DTCollectionViewManager/DTCollectionViewManager+Delegate.swift b/Sources/DTCollectionViewManager/DTCollectionViewManager+Delegate.swift index 6813eb6..8bd00af 100644 --- a/Sources/DTCollectionViewManager/DTCollectionViewManager+Delegate.swift +++ b/Sources/DTCollectionViewManager/DTCollectionViewManager+Delegate.swift @@ -254,15 +254,6 @@ extension DTCollectionViewManager { collectionDelegate?.appendNonCellReaction(.previewForDismissingContextMenu, closure: closure) } - #if compiler(<5.1.2) - @available(iOS 13.0, *) - /// Registers `closure` to be executed when `UICollectionViewDelegate.tableView(_:willCommitMenuWithAnimator:)` method is called - open func willCommitMenuWithAnimator(_ closure: @escaping (UIContextMenuInteractionCommitAnimating) -> Void) - { - collectionDelegate?.appendNonCellReaction(.willCommitMenuWithAnimator, closure: closure) - } - #endif - #endif #if compiler(>=5.5) && os(iOS) diff --git a/Sources/DTCollectionViewManager/DTCollectionViewManager.swift b/Sources/DTCollectionViewManager/DTCollectionViewManager.swift index a68697a..3446373 100644 --- a/Sources/DTCollectionViewManager/DTCollectionViewManager.swift +++ b/Sources/DTCollectionViewManager/DTCollectionViewManager.swift @@ -389,7 +389,6 @@ internal enum EventMethodSignature: String { case contextMenuConfigurationForItemAtIndexPath = "collectionView:contextMenuConfigurationForItemAtIndexPath:point:" case previewForHighlightingContextMenu = "collectionView:previewForHighlightingContextMenuWithConfiguration:" case previewForDismissingContextMenu = "collectionView:previewForDismissingContextMenuWithConfiguration:" - case willCommitMenuWithAnimator = "collectionView:willCommitMenuWithAnimator:" case canEditItemAtIndexPath = "collectionView:canEditItemAtIndexPath:" case selectionFollowsFocusForItemAtIndexPath = "collectionView:selectionFollowsFocusForItemAtIndexPath:" case targetIndexPathForMoveOfItemFromOriginalIndexPath = "collectionView:targetIndexPathForMoveOfItemFromOriginalIndexPath:atCurrentIndexPath:toProposedIndexPath:" diff --git a/Sources/Tests/ReactingToEventsTestCase.swift b/Sources/Tests/ReactingToEventsTestCase.swift index c720114..3088dd4 100644 --- a/Sources/Tests/ReactingToEventsTestCase.swift +++ b/Sources/Tests/ReactingToEventsTestCase.swift @@ -994,17 +994,7 @@ class ReactingToEventsFastTestCase : XCTestCase { _ = sut.manager.collectionDelegate?.collectionView(sut.collectionView, previewForDismissingContextMenuWithConfiguration: .init()) waitForExpectations(timeout: 1, handler: nil) } - #if compiler(<5.1.2) - func testWillCommitMenuWithAnimator() { - guard #available(iOS 13, *) else { return } - let exp = expectation(description: "willCommitMenuWithAnimator") - sut.manager.willCommitMenuWithAnimator { animator in - exp.fulfill() - } - _ = sut.manager.collectionDelegate?.collectionView(sut.collectionView, willCommitMenuWithAnimator: ContextMenuInteractionAnimatorMock()) - waitForExpectations(timeout: 1, handler: nil) - } - #endif + #endif #if os(tvOS) @@ -1119,9 +1109,6 @@ class ReactingToEventsFastTestCase : XCTestCase { XCTAssertEqual(String(describing: #selector(UICollectionViewDelegate.collectionView(_:contextMenuConfigurationForItemAt:point:))), EventMethodSignature.contextMenuConfigurationForItemAtIndexPath.rawValue) XCTAssertEqual(String(describing: #selector(UICollectionViewDelegate.collectionView(_:previewForHighlightingContextMenuWithConfiguration:))), EventMethodSignature.previewForHighlightingContextMenu.rawValue) XCTAssertEqual(String(describing: #selector(UICollectionViewDelegate.collectionView(_:previewForDismissingContextMenuWithConfiguration:))), EventMethodSignature.previewForDismissingContextMenu.rawValue) - #if compiler(<5.1.2) - XCTAssertEqual(String(describing: #selector(UICollectionViewDelegate.collectionView(_:willCommitMenuWithAnimator:))), EventMethodSignature.willCommitMenuWithAnimator.rawValue) - #endif } #if compiler(>=5.5)