All Projects → mac-gallagher → Shuffle

mac-gallagher / Shuffle

Licence: mit
🔥 A multi-directional card swiping library inspired by Tinder

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Shuffle

Verticalcardswiper
A marriage between the Shazam Discover UI and Tinder, built with UICollectionView in Swift.
Stars: ✭ 830 (+55.14%)
Mutual labels:  swipe, cards, tinder
Swipeablecards
Stars: ✭ 136 (-74.58%)
Mutual labels:  swipe, cards, tinder
Hswiper Wx
微信小程序swiper插件
Stars: ✭ 167 (-68.79%)
Mutual labels:  swipe, swiper
React Swipes
🔥 基于React的移动端卡片滑动组件
Stars: ✭ 177 (-66.92%)
Mutual labels:  swipe, swiper
kikder-dating-swipe-app
❤️ Kik App, you know? 💑 Kikder™ is a dating webapp that integrates the Kik, uses the HorOrNot game and the Tinder swipe. The F.A.S.T. Game Approach! The web app uses a custom lightweight MVC framework.
Stars: ✭ 21 (-96.07%)
Mutual labels:  swipe, tinder
React Native Web Swiper
Swiper-Slider for React-Native and React-Native-Web
Stars: ✭ 125 (-76.64%)
Mutual labels:  swipe, swiper
Vue Awesome Swiper
🏆 Swiper component for @vuejs
Stars: ✭ 12,072 (+2156.45%)
Mutual labels:  swipe, swiper
React Native Swiper Flatlist
👆 Swiper component implemented with FlatList using Hooks & Typescript + strict automation tests with Detox
Stars: ✭ 217 (-59.44%)
Mutual labels:  swipe, swiper
React Native Deck Swiper
tinder like react-native deck swiper
Stars: ✭ 1,261 (+135.7%)
Mutual labels:  swipe, tinder
react-tinder-card
A npm react module for making react elements swipeable like in the dating app tinder.
Stars: ✭ 184 (-65.61%)
Mutual labels:  swipe, tinder
tcard
Flutter tinder like cards
Stars: ✭ 132 (-75.33%)
Mutual labels:  cards, tinder
Tinderswipeview
Swipe view inspired by tinder
Stars: ✭ 289 (-45.98%)
Mutual labels:  swipe, tinder
Vuetify Swipeout
👆 A swipe out example built with Vue CLI 3 + Vuetify + Swiper.
Stars: ✭ 117 (-78.13%)
Mutual labels:  swipe, swiper
Vue Swipe Mobile
😃 A siwpe (touch slider) component for Vue2
Stars: ✭ 97 (-81.87%)
Mutual labels:  swipe, swiper
Ionic Tinder Ui
Just a Tinder UI on Ionic
Stars: ✭ 86 (-83.93%)
Mutual labels:  swipe, tinder
Placeholderview
This library provides advance views for lists and stacks. Some of the views are build on top of RecyclerView and others are written in their own. Annotations are compiled by annotation processor to generate bind classes. DOCS -->
Stars: ✭ 2,104 (+293.27%)
Mutual labels:  swipe, tinder
Swiper
Most modern mobile touch slider with hardware accelerated transitions
Stars: ✭ 29,519 (+5417.57%)
Mutual labels:  swipe, swiper
React Native Card Stack Swiper
Tinder like react-native card stack swiper
Stars: ✭ 315 (-41.12%)
Mutual labels:  swipe, tinder
Flare
A full-fledged unofficial Angular-based Tinder web client
Stars: ✭ 23 (-95.7%)
Mutual labels:  swipe, tinder
Vue Easy Slider
Slider Component of Vue.js.
Stars: ✭ 313 (-41.5%)
Mutual labels:  swipe, swiper

Platform Swift Version Build Status Swift Package Manager CocoaPods Carthage Code Coverage LICENSE

Made with ❤️ by Mac Gallagher

Features

💡 Advanced swipe recognition based on velocity and card position

💡 Manual and programmatic actions

💡 Smooth card overlay view transitions

💡 Fluid and customizable animations

💡 Dynamic card loading using data source pattern

Example

To run the example project, clone the repo and run the ShuffleExample target.

Basic Usage

  1. Create your own card by either subclassing SwipeCard or setting its properties directly:

    func card(fromImage image: UIImage) -> SwipeCard {
      let card = SwipeCard()
      card.swipeDirections = [.left, .right]
      card.content = UIImageView(image: image)
      
      let leftOverlay = UIView()
      leftOverlay.backgroundColor = .green
      
      let rightOverlay = UIView()
      rightOverlay.backgroundColor = .red
      
      card.setOverlays([.left: leftOverlay, .right: rightOverlay])
      
      return card
    }
    

    The card returned from card(fromImage:) displays an image, can be swiped left or right, and has overlay views for both directions.

  2. Initialize your card data and place a SwipeCardStack on your view:

    class ViewController: UIViewController {
      let cardStack = SwipeCardStack()
      
      let cardImages = [
          UIImage(named: "cardImage1"),
          UIImage(named: "cardImage2"),
          UIImage(named: "cardImage3")
      ]
      
      override func viewDidLoad() {
        super.viewDidLoad()
        view.addSubview(cardStack)
        cardStack.frame = view.safeAreaLayoutGuide.layoutFrame
      }
    }
    
  3. Conform your class to SwipeCardStackDataSource and set your card stack's dataSource:

    func cardStack(_ cardStack: SwipeCardStack, cardForIndexAt index: Int) -> SwipeCard {
      return card(fromImage: cardImages[index])
    }
    
    func numberOfCards(in cardStack: SwipeCardStack) -> Int {
      return cardImages.count
    }
    
    cardStack.dataSource = self
    
  4. Conform to SwipeCardStackDelegate to subscribe to any of the following events:

     func cardStack(_ cardStack: SwipeCardStack, didSelectCardAt index: Int)
     func cardStack(_ cardStack: SwipeCardStack, didSwipeCardAt index: Int, with direction: SwipeDirection)
     func cardStack(_ cardStack: SwipeCardStack, didUndoCardAt index: Int, from direction: SwipeDirection)
     func didSwipeAllCards(_ cardStack: SwipeCardStack)
    

    Note: didSwipeCardAt and didSwipeAllCards are called regardless if a card is swiped programmatically or by the user.

Card Stack Actions

The following methods are available on SwipeCardStack.

Swipe

Performs a swipe programmatically in the given direction.

func swipe(_ direction: SwipeDirection, animated: Bool)

Shift

Shifts the card stack's cards by the given distance. Any swiped cards are skipped over.

func shift(withDistance distance: Int = 1, animated: Bool)

Undo

Returns the most recently swiped card to the top of the card stack.

func undoLastSwipe(animated: Bool)

Card Layout

Each SwipeCard consists of three UI components: its content, footer, and overlay(s).

Content

The content is the card's primary view. You can include your own card template here.

var content: UIView? { get set }

Footer

The footer is an axuilliary view on the bottom of the card. It is laid out above the content in the view hierarchy if the footer is transparent. Otherwise, the footer is drawn just below the content.

var footer: UIView? { get set }
var footerHeight: CGFloat { get set }

Overlays

An overlay is a view whose alpha value reacts to the user's dragging. The overlays are laid out above the footer, regardless if the footer is transparent or not.

func overlay(forDirection direction: SwipeDirection) -> UIView?
func setOverlay(_ overlay: UIView?, forDirection direction: SwipeDirection)
func setOverlays(_ overlays: [SwipeDirection: UIView])

Advanced Usage

For more advanced usage, including

visit the document here.

Installation

CocoaPods

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

pod 'Shuffle-iOS'

The import statement in this case will be

import Shuffle_iOS

Carthage

Shuffle is available through Carthage. To install it, simply add the following line to your Cartfile:

github "mac-gallagher/Shuffle"

Swift Package Manager

Shuffle is available through Swift PM. To install it, simply add the package as a dependency in Package.swift:

dependencies: [
  .package(url: "https://github.com/mac-gallagher/Shuffle.git", from: "0.1.0"),
]

Manual

Download and drop the Shuffle directory into your project.

Requirements

  • iOS 9.0+
  • Xcode 10.2+
  • Swift 5.0+

Apps Using Shuffle

We love to hear about apps that use Shuffle - feel free to submit a pull request and share yours here!


Made with ❤️ by Mac Gallagher

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].