Latest 0.1.1
Homepage https://github.com/abramchuk-v/CardViews
License Apache License
Platforms ios 10.0
Authors

CardViews

Collection like a Badoo or Tinder cards

CardViews Swift 3.0

Sample

If you want to create something like a badoo card, then enjoy it!

Installation

SWCardView requires iOS 10.0 or later.

Using CocoaPods

  1. Add the pod SWCardView to your Podfile.

pod ‘SWCardView’

  1. Run pod install from Terminal, then open your app’s .xcworkspace file to launch Xcode.

Usage

import SWCardView
  1. Register cardView.
    let cardView = SwipeCardsView(frame: frame)
    cardView.delegate = self
    cardView.dataSource = self
    self.view.addSubview(cardView)
    cardView.reloadData()
  2. Add DataSource and Delegate method.

    
    extension ViewController: SwipeCardViewDelegate {
    func nearOfEnd() {
        obtainNewData()
    }
    
    func swipedLeft(_ object: Any) {
        //left action
    }
    
    func swipedRight(_ object: Any) {
        //right action
    }
    
    func cardTapped(_ object: Any) {
        //tap
    }
    
    func reachedEnd() {
        //end
    }
    }

extension ViewController: SwipeCardViewDataSource {
func createViewForOverlay(index: Int, swipe: SwipeMode, with frame: CGRect) -> UIView {
let label = UILabel()
label.frame.size = CGSize(width: 100, height: 100)
label.center = CGPoint(x: frame.width / 2, y: frame.height / 2)
label.text = swipe == .right ? "right" : "left"
return label
}

func rowCount() -> Int {
    return dataArray.count
}

func createViewForCard(index: Int, with frame: CGRect) -> UIView {
    let cell = ProblemCell(frame: frame)
    cell.element = dataArray[index]
    return cell
}

}



## Demo

Build and run the `testTind` project in Xcode to see this pod in action.
Have fun.

## Contact

Abramchuk Vladislav

- http://github.com/abramchuk-v

- [email protected]

## License

This project is available under the Apache 2.0 license. See the LICENSE file for more info.

Latest podspec

{
    "name": "SWCardView",
    "version": "0.1.1",
    "summary": "Simple way to create view like a badoo or a tinder.",
    "description": "Simple way to create view like a badoo or a tinder. When you swipe that view, it's going out of screen.",
    "homepage": "https://github.com/abramchuk-v/CardViews",
    "license": {
        "type": "Apache License",
        "file": "LICENSE"
    },
    "authors": {
        "Uladzislau Abramchuk": "[email protected]"
    },
    "platforms": {
        "ios": "10.0"
    },
    "source": {
        "git": "https://github.com/abramchuk-v/CardViews.git",
        "tag": "0.1.1"
    },
    "source_files": "testTind/TinderView/*",
    "swift_version": "3.0"
}

Pin It on Pinterest

Share This