Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to swipe left to delete a CollectionCell

I am using a UICollectionView library called VegaScroll. The library is located at https://github.com/ApplikeySolutions/VegaScroll. My question is how can I add a swipe left feature to this, so when the user swipes left, the collection cell shows the trash image and gets deleted? I know its very simple in a table, but I am using this library which is a collection view. I have searched on all the questions on this forum, but they haven't solved this problem. Something like below. I'm also using an XIB for my cell.

enter image description hereThanks all

like image 273
Chris Avatar asked Oct 27 '25 07:10

Chris


1 Answers

It is a tableView existed functionality. For collectionView you should write it on your own. There is no existed pre-built solution.

You can use the pod like this (which can what do you need)

https://github.com/SwipeCellKit/SwipeCellKit

Or custom written simple logic like here:

https://medium.com/@ales.musto/using-a-uipangesturerecognizer-to-delete-cells-in-a-uicollectionview-swift-3-e91cdfcce5be

Update: There is actually a way to do this (now) with a built-in API:

How do you support swiping to delete a row in a UICollectionView list with compositional layout?

like image 128
Alexander Nikolaychuk Avatar answered Oct 28 '25 19:10

Alexander Nikolaychuk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!