Skip to content

Conversation

gsabran
Copy link

@gsabran gsabran commented May 29, 2019

This change adds new delegation APIs that:

  • expose the gesture moving the cell to allow for further customization of the snapshot at those time
  • let the delegate decide whether the cell should be deleted on release

and it ads an example in the demo project.

videodeletion

@adamshin
Copy link
Owner

adamshin commented Jun 4, 2019

Thanks for your time putting this together.

I'm wondering if this is enough of a general-purpose feature to merge into the master branch. It seems like a somewhat niche use case, and I'm guessing most end users would want to customize the interaction beyond what the library could usefully provide. It also starts exposing internal details like the gesture recognizer, which might cause issues if the implementation needed to change in the future.

I think we could add hooks for supporting this behavior in a more general way, as well as other custom behaviors users might want to add. Maybe starting with a delegate method like this:

func tableViewShouldFinishReorder(_ tableView: UITableView, from initialSourceIndexPath: IndexPath, to finalDestinationIndexPath: IndexPath, with snapshotView: UIView) -> Bool

which could be overridden by users to perform a custom behavior instead of reordering the cell. (i.e. cancel the reorder, remove the item from the array, reload the tableview.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants