zhxnlai / ZLSwipeableViewSwift

A simple view for building card like interface inspired by Tinder and Potluck.
MIT License
2.25k stars 228 forks source link

Determining swipe direction in Swiping delegate method #71

Closed mparrish91 closed 8 years ago

mparrish91 commented 8 years ago

I'm close to the functionally I want, but just introduced a few bugs. I'm trying to handle horizontal and vertical swiping and do so in independent cases.

I'm very happy with the functionality on left and right swipes, but once vertical is introduced it breaks my setup. My current thought is to disable horizontal swiping completely and only allow the view to move vertically once a vertical swipe is triggered. I'm open to other thoughts though.

I'm also not sure how to completely disable horizontal swiping if I do go with that. and not allow the card to move on the x at all

screen shot 2016-08-17 at 9 56 17 am

screen shot 2016-08-17 at 9 56 17 am

AndrewSB commented 8 years ago

this looks almost completely right, I'd change two things to fix the vertical swiping issue you're running into.

  1. move the shareSheet() functionality into into swipeableView.didEnd, instead of .swiping
  2. your if clause for up only fires when the translation.x == 0. That seems like an unrealistic constraint, rarely will a user be able to drag the card directly up without moving a pixel to the left right. Maybe remove the == 0 constraint or re-think when you want the images to show up?
mparrish91 commented 8 years ago

Thanks for the tip!