Inspired animation from Tinder and Potluck with random undo feature!
Run in physical device for better animaton!!!!
Tinder Swipe can be added to storyboard or instantiated programmatically:
func createTinderCard(at index: Int , value :String) -> TinderCard {
let card = TinderCard(frame: CGRect(x: 0, y: 0, width: viewTinderBackGround.frame.size.width , height: viewTinderBackGround.frame.size.height - 50) ,value : value)
card.delegate = self
return card
}
func rightClickAction(){
let card = currentLoadedCardsArray.first
card?.rightClickAction()
}
func leftClickAction(){
let card = currentLoadedCardsArray.first
card?.leftClickAction()
}
func makeUndoAction(){
let card = currentLoadedCardsArray.first
undoCard.makeUndoAction()
}
func discardCard(){
let card = currentLoadedCardsArray.first
undoCard.makeUndoAction()
}
func shakeAnimationCard(){
let card = currentLoadedCardsArray.first
card?.shakeAnimationCard()
}
Here is a list of callbacks you can listen to:
protocol TinderCardDelegate: NSObjectProtocol {
func cardGoesLeft(card: TinderCard)
func cardGoesRight(card: TinderCard)
func currentCardStatus(card: TinderCard, distance: CGFloat)
}
* Swift 4.1
* XCode 9
* iOS 8.0 (Min SDK)
Nicky Patson
Tinder Swipe View is available under the MIT license. See the LICENSE file for more info.