Utilizing FacebookвЂ™s POP animation framework to simplify things, and supply a far more out from the field animation that is dynamic I use a POPBasicAnimation to your card translating it is X and Y origin to a value off the screen.
as soon as this animation is complete I call my delegate function self.delegate?.didEndSwipe(onView: self) and depend on my delegate (which included this SwipeableView as being a subview) to eliminate this SwipeableView as being a subview. This card is currently entirely taken out of the stack as well as its task is performed.
In the event that dragPercentage is certainly not 60% or maybe more, or if the pan gestureвЂ™s state is terminated or unsuccessful, i have to animate it straight back to the stack. Typically this animation would be only a little rubber-band-like springy bounce animation that communicates that the swipe failed as well as the individual has вЂlet goвЂ™ regarding the card, and can fling back again to its initial spot, just as you’d expect into the world physics space that is real.
Performing this animation can be straightforward as applying a POPSpringAnimation in the rotation which was currently applied, to reverse it from the present values into the values that are original. (more…)Read More