Utilizing Facebook’s POP animation framework to simplify things, and offer an even more from the package animation that is dynamic we use a POPBasicAnimation into the card translating it is X and Y origin to a value from the display screen.
When this animation is complete I call my delegate function self.delegate?.didEndSwipe(onView: self) and depend on my delegate (which added this SwipeableView as being a subview) to get rid of this SwipeableView being a Gluten Free dating only reviews subview. This card happens to be totally taken out of the stack and its own work is completed.
In the event that dragPercentage just isn’t 60% or maybe more, or if perhaps the pan gesture’s state is terminated or failed, i have to back animate it to the stack. Typically this animation may be just a little rubber-band-like springy bounce animation that communicates that the swipe failed therefore the individual has вЂlet go’ regarding the card, allowing it to fling back once again to its initial destination, just as you’ll expect within the real life physics space.
Performing this animation is really as straightforward as using a POPSpringAnimation in the rotation which was currently used, to reverse it from the current values into the values that are original. Along with a POPSpringAnimation from the interpretation we used from the present values to its initial values. POPSpringAnimation will make sure that the values that are actual overshot slightly to and fro causing the springtime impact that people desired.