JoniVR / VerticalCardSwiper

A marriage between the Shazam Discover UI and Tinder, built with UICollectionView in Swift.
MIT License
1.4k stars 101 forks source link

[Feature Request] Ability to set custom Swipe Percentage Margin #58

Closed AmandeepTMSFalcon closed 5 years ago

AmandeepTMSFalcon commented 5 years ago

Now when I swipe 20-30% then card goes to left and right. But I want ratio of 5%. When I just swipe 5% then card should be goes to left and right. Where I need to change ?????

JoniVR commented 5 years ago

Currently this is not implemented in the API yet, but I might add this in a future version.

If you want to modify the behaviour in your own project, you need to change the swipePercentageMargin variable found here:https://github.com/JoniVR/VerticalCardSwiper/blob/45a4c3bf7686b1e7496040d5d510f30bcdd372ae/Sources/CardCell.swift#L91

Feel free to implement it yourself in a PR if you don't want to wait for me to do it.

AmandeepTMSFalcon commented 5 years ago

I changed this also but no getting any effect on the swipe margin percentage. I update this to let swipePercentageMargin = self.bounds.width * 0.1

And if I commented endedPanAnimation() function then code is also working. I don't know where I am doing something wrong. Please correct me also.

JoniVR commented 5 years ago

And if I commented endedPanAnimation() function then code is also working.

This is weird because when I comment that line out it does break the code:

ezgif com-video-to-gif

Maybe you're still testing the old build on accident? Try cleaning your build folder perhaps?

AmandeepTMSFalcon commented 5 years ago

And if I commented endedPanAnimation() function then code is also working.

This is weird because when I comment that line out it does break the code:

ezgif com-video-to-gif

Maybe you're still testing the old build on accident? Try cleaning your build folder perhaps?

Thanks JoniVR. The problem was with cache.

AmandeepTMSFalcon commented 5 years ago

Hello JoniVR,

I am unable to reload the number of cards and cellForItemAt. I am doing code like: let mainCard:VerticalCardSwiper! Then mainCard.reloadData()

This is not working. Please help me to sort out this.