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.

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 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.

SampleSwipeableCard

animal lover dating websites

Given that we’ve implemented SwipeableView, creating custom cards that look various, have their content that is own such UILabels , UIImages and UIButtons as subviews can be as effortless as inheriting from SwipeableView . The subclass it self is strictly accountable for handling a unique content and utilizes the superclass to manage all the swipe-able logic that ended up being simply implemented.

I’ve created a SampleSwipeableCard subclass which has a a UILabel for the name, and a subtitle, in addition to a red UIButton with an advantage icon and a UIView with a definite back ground color which contains a internal uiimageview . Continue reading “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.”