A lightweight solution for introducing swipable cards like Tinder or AngelList. Just a few hundred lines of code.
#import <MXCardsSwipingView/MXCardsSwipingView.h>
Create an MXCardsSwipingView
and add it to your view hierarchy. Add cards to it with enqueueCard:
. Each card added is immediately added to the view heirarchy behind the previously enqueued cards. When a card is dismissed you can enqueue more during the delegate callback
- (BOOL)cardsSwipingView:(MXCardsSwipingView*)cardsSwipingView willDismissCard:(UIView*)card toLeft:(BOOL)toLeft;
A card can be any UIView
, but you can get more customizability by adopting the MXSwipableCard
protocol (e.g. to fade in a certain subview of the card depending on the swipe direction).
The example project (which is featured in the above gifs) shows how to add a drop shadow to a card with corner radius as well as how to add differing transforms to background cards as opposed to the top card.
Whatever size you enqueue a card with, it stays that size. Only the center of the card will be readjusted and managed by MXCardsSwipingView
.
Check out MXCardsSwipingView.h
for full API.
To run the example project, clone the repo, and run pod install
from the Example directory first.
Deployment target of at least iOS 7.0.
MXCardsSwipingView is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "MXCardsSwipingView"
Scott Kensell, skensell@gmail.com
MXCardsSwipingView is available under the MIT license. See the LICENSE file for more info.