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

expose new delegation APIs and handle cell deletion #51

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

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