Latest 0.1.1
License MIT
Platforms ios 8.0




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


  • iOS 8 or later
  • Swift 4.0


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

pod "KKSwipeCards"

How to use

First import the module:

import KKSwipeCards

Next create an instance of a KKSwipeCardsView:
(Element can be your custom model, or just [String: String])

let swipeView = KKSwipeCardsView<Element>(frame: frame,
                                          viewGenerator: viewGenerator,
                                          overlayGenerator: overlayGenerator)

Views get loaded lazy, so you have to provide KKSwipeCardsView with a ViewGenerator and optionally an OverlayGenerator.

let viewGenerator: ([String: String], CGRect) -> (UIView) = { (element: [String: String], frame: CGRect) -> (UIView) in
  // return a Card(UIView)

let overlayGenerator: ([String: String], SwipeMode, CGRect) -> (UIView) = { (element: [String: String], mode: SwipeMode, frame: CGRect) -> (UIView) in
  // return a Overlay design(UIView)

Adding cards

To add new cards, just call the addCards method with an array of the previously defined Element:

swipeView.addCards([String: String], onTop: true)


KKSwipeCardsView has a delegate property so you can get informed when a card has been swiped. The delegate has to implement following methods:

func swipedLeft(_ object: Any)
func swipedRight(_ object: Any)
func swipedTop(_ object: Any)
func swipedBottom(_ object: Any)
func cardTapped(_ object: Any)
func reachedEndOfStack()

The object parameter is guaranteed to have the type Element. Making Element as generics in delegate will increase complexity.


For a nice working demo sample, please take a look the Example project.
Run pod install to run the example in the Example directory.


Added features over DMSwipeCards

  • Swipe top and bottom
  • Passing data in overlayGenerator
  • Card won’t swipe if user touch in scrollView part of card (In GestureRecognizer, shouldRecognizeSimultaneouslyWith is made false)
  • Example with retaining the previous card when swiping in bottom


Vinoth Anandan, [email protected]


Bug reports and pull requests are welcome on GitHub at


KKSwipeCards is available under the MIT License. See the License file for more info.

Latest podspec

    "name": "KKSwipeCards",
    "version": "0.1.1",
    "summary": "Tinder like card interface with four side swipe.",
    "description": "Written in Swift 4, supports custom views for the card and the overlay. Views get loaded lazily, so there's no issues in loading a huge amount of cards.",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "Vinoth Anandan": "[email protected]"
    "source": {
        "git": "",
        "tag": "0.1.1"
    "platforms": {
        "ios": "8.0"
    "source_files": "KKSwipeCards/Classes/**/*",
    "pushed_with_swift_version": "4.0"

Pin It on Pinterest

Share This