larryryu / LSSwipeToDeleteCollectionViewLayout

The UICollectionViewLayout subclass adds swipe to delete functionality to a collectionview
MIT License
41 stars 4 forks source link

Right Swipe #10

Open SteveYurka opened 9 years ago

SteveYurka commented 9 years ago

Your library is really nice, I have looked through a bunch of different swipe to delete libraries, and this one is extremely smooth and doesn't seem to bug when swiping to fast, or have any random behaviour

However, I did notice that you can only swipe items to the left? I tried this on an iPhone 5 and 6

Is this intentional or is this a bug? If it is intentional do you have any intention of including a right swipe gesture, or are you able to give some guidance on how a right swipe could be added

Thanks for you code and time!

larryryu commented 9 years ago

Thanks for your feedback. Good question and it should probably be in the readme so that it is clear. LSSwipeToDeleteCollectionViewLayout is just a subclass of UICollectionViewFlowLayout. It also has a the following property

@property (nonatomic, assign) LSSwipeToDeleteDirection swipeToDeleteDirection;

this can be set to

LSSwipeToDeleteDirectionMin //default which gives you the swipe to left

or

LSSwipeToDeleteDirectionMax //which would give you swipe to right (which i believe is the behavior you are looking for).

If you wanted you could also do

layout.swipeToDeleteDirection = (LSSwipeToDeleteDirectionMin | LSSwipeToDeleteDirectionMax)

which would give you both left and right swipe all together.

It is also worth noting that left, right is relative to the scroll direction (i.e vertical/horizontal). With horizontal scroll direction LSSwipeToDeleteDirectionMin implies up and LSSwipeToDeleteDirectionMax implies down.

You can also look at the LSSwipeToDeleteCollectionViewLayout.h for all the public methods and constants.

Hope that helps