michal-czw / MXCardsSwipingView

A lightweight UIView for Tinder style swiping through a stack of cards.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MXCardsSwipingView

Version License Platform

A lightweight solution for introducing swipable cards like Tinder or AngelList. Just a few hundred lines of code.

Preview

Swiping example Swiping example

Usage

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

Development

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Deployment target of at least iOS 7.0.

Installation

MXCardsSwipingView is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "MXCardsSwipingView"

Author

Scott Kensell, skensell@gmail.com

License

MXCardsSwipingView is available under the MIT license. See the LICENSE file for more info.

About

A lightweight UIView for Tinder style swiping through a stack of cards.

License:MIT License


Languages

Language:Objective-C 93.7%Language:Ruby 6.3%