Card flip animation by pan gesture.
Switch branches/tags
Nothing to show
Clone or download
Failed to load latest commit information.
Classes Refactor and add document. Jan 10, 2018
Demo Refactor and add document. Jan 10, 2018
docs Refactor and add document. Jan 10, 2018
LICENSE Refactor and add document. Jan 10, 2018 Refactor and add document. Jan 10, 2018


Design from Dribble. Design from Dribble


Two Solutions

At the begin, I didn't encapsulate code, @luxorules refactor code into class and improve it to support not only image, then I encapsulate my code into class. So, there are two choices.

CardContainerView by seedante

Here is CardContainerView API reference. CardContainerView supports custom card size, pan gesture.


let cardContainerView = CardContainerView(frame: aFrame)// with defalut card size.
cardContainerView.dataSource = id<CardContainerDataSource>


public protocol CardContainerDataSource: class{
    func numberOfCards(for cardContainerView: UICardContainerView) -> Int
    func cardContainerView(_ cardContainerView: UICardContainerView, imageForCardAt index: Int) -> UIImage?

CardAnimationView by @luxorules

CardAnimationView supports custom card size, pan gesture.

Usage is simple also:

let cardAnimationView = CardAnimationView.init(frame: aFrame)// with defalut card size.
cardAnimationView.dataSourceDelegate = id<CardAnimationViewDataSource>

It adds a little complexity to exchange for: custom card view(not only image).

protocol CardAnimationViewDataSource : class {
    func numberOfVisibleCards() -> Int
    func numberOfCards() -> Int
    // Return view displayed in the CardAnimationView. If reusedView is not nil,
    // you could configure and return it to reuse it.
    func cardNumber(number:Int, reusedView:BaseCardView?) -> BaseCardView


  • CardAnimationView: UIView, the view to display a list of card view.
  • BasedCardView: UIView, all custom card view must be inherited from this class.
  • ImageCardView: BasedCardView, child class of BasedCardView, if you just want to use image, use this class.


  • iOS 8.0/Swift 4.0


Two solutions are both single file. They are in Classes folder. Just need to import file into your project.


The project is released under the MIT LICENSE. And relative technical points are moved to wiki.