Skip to content

Commit

Permalink
Remove wrappers for removed delegate method.
Browse files Browse the repository at this point in the history
  • Loading branch information
DenTelezhkin committed Dec 2, 2021
1 parent b079ec3 commit 11c56e4
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 32 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:"
Expand Down
15 changes: 1 addition & 14 deletions Sources/Tests/ReactingToEventsTestCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 11c56e4

Please sign in to comment.