{"id":18047427,"url":"https://github.com/mac-gallagher/shuffle","last_synced_at":"2025-05-15T23:08:35.652Z","repository":{"id":46965644,"uuid":"200533274","full_name":"mac-gallagher/Shuffle","owner":"mac-gallagher","description":"🔥 A multi-directional card swiping library inspired by Tinder","archived":false,"fork":false,"pushed_at":"2024-08-14T04:25:10.000Z","size":16756,"stargazers_count":940,"open_issues_count":32,"forks_count":141,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-05-15T23:08:18.955Z","etag":null,"topics":["cards","cardstack","cardview","swipe","swipe-card","swipe-cards","swipe-view","swipeable","swiper","swipeview","tinder","tinder-card","tinder-cards","tinder-swiper","tinder-ui"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mac-gallagher.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-04T19:28:05.000Z","updated_at":"2025-05-15T15:22:57.000Z","dependencies_parsed_at":"2024-10-30T19:11:27.333Z","dependency_job_id":null,"html_url":"https://github.com/mac-gallagher/Shuffle","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mac-gallagher%2FShuffle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mac-gallagher%2FShuffle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mac-gallagher%2FShuffle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mac-gallagher%2FShuffle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mac-gallagher","download_url":"https://codeload.github.com/mac-gallagher/Shuffle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254436949,"owners_count":22070947,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cards","cardstack","cardview","swipe","swipe-card","swipe-cards","swipe-view","swipeable","swiper","swipeview","tinder","tinder-card","tinder-cards","tinder-swiper","tinder-ui"],"created_at":"2024-10-30T19:11:20.275Z","updated_at":"2025-05-15T23:08:29.734Z","avatar_url":"https://github.com/mac-gallagher.png","language":"Swift","readme":"\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/mac-gallagher/Shuffle/master/Assets/logo.png\" width=\"650\"\u003e\n\u003c/p\u003e\n\n\u003c/br\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://cocoapods.org/pods/Shuffle-iOS\"\u003e\u003cimg alt=\"Platform\" src=\"https://img.shields.io/cocoapods/p/Shuffle-iOS.svg\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://swift.org\"\u003e\u003cimg alt=\"Swift Version\" src=\"https://img.shields.io/badge/swift-5.x.x-223344.svg?logo=swift\u0026labelColor=FA7343\u0026logoColor=white\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://travis-ci.org/mac-gallagher/Shuffle\"\u003e\u003cimg alt=\"Build Status\" src=\"https://travis-ci.org/mac-gallagher/Shuffle.svg?branch=master\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://swift.org/package-manager\"\u003e\u003cimg alt=\"Swift Package Manager\" src=\"https://img.shields.io/badge/swift pm-compatible-yellow.svg\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://cocoapods.org/pods/Shuffle-iOS\"\u003e\u003cimg alt=\"CocoaPods\" src=\"https://img.shields.io/cocoapods/v/Shuffle-iOS.svg\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/Carthage/Carthage\"\u003e\u003cimg alt=\"Carthage\" src=\"https://img.shields.io/badge/carthage-compatible-blue.svg?style=flat)\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://codecov.io/gh/mac-gallagher/Shuffle\"\u003e\u003cimg alt=\"Code Coverage\" src=\"https://codecov.io/gh/mac-gallagher/Shuffle/branch/master/graph/badge.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/mac-gallagher/Shuffle/blob/master/LICENSE\"\u003e\u003cimg alt=\"LICENSE\" src=\"https://img.shields.io/cocoapods/l/Shuffle-iOS\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\nMade with ❤️ by \u003ca href=\"https://github.com/mac-gallagher\"\u003eMac Gallagher\u003c/a\u003e\n\u003c/p\u003e\n\n## Features\n\n💡 Advanced swipe recognition based on velocity and card position\n\n💡 Manual and programmatic actions\n\n💡 Smooth card overlay view transitions\n\n💡 Fluid and customizable animations\n\n💡 Dynamic card loading using data source pattern\n\n## Example\nTo run the example project, clone the repo and run the `ShuffleExample` target.\n\n\u003cp align=\"left\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/mac-gallagher/Shuffle/master/Assets/swipe_example.gif\" width=\"280\"\u003e\n\u003c/p\u003e\n\n## Basic Usage\n\n1.  Create your own card by either subclassing `SwipeCard` or setting its properties directly:\n\n    \n    ```swift\n    func card(fromImage image: UIImage) -\u003e SwipeCard {\n      let card = SwipeCard()\n      card.swipeDirections = [.left, .right]\n      card.content = UIImageView(image: image)\n      \n      let leftOverlay = UIView()\n      leftOverlay.backgroundColor = .green\n      \n      let rightOverlay = UIView()\n      rightOverlay.backgroundColor = .red\n      \n      card.setOverlays([.left: leftOverlay, .right: rightOverlay])\n      \n      return card\n    }\n    ```\n    The card returned from `card(fromImage:)` displays an image, can be swiped left or right, and has overlay views for both directions.\n\n2. Initialize your card data and place a `SwipeCardStack` on your view:\n\n    ```swift\n    class ViewController: UIViewController {\n      let cardStack = SwipeCardStack()\n      \n      let cardImages = [\n          UIImage(named: \"cardImage1\"),\n          UIImage(named: \"cardImage2\"),\n          UIImage(named: \"cardImage3\")\n      ]\n      \n      override func viewDidLoad() {\n        super.viewDidLoad()\n        view.addSubview(cardStack)\n        cardStack.frame = view.safeAreaLayoutGuide.layoutFrame\n      }\n    }\n    ```\n    \n3. Conform your class to `SwipeCardStackDataSource` and set your card stack's `dataSource`:\n    \n    ```swift\n    func cardStack(_ cardStack: SwipeCardStack, cardForIndexAt index: Int) -\u003e SwipeCard {\n      return card(fromImage: cardImages[index])\n    }\n    \n    func numberOfCards(in cardStack: SwipeCardStack) -\u003e Int {\n      return cardImages.count\n    }\n    ```\n    ```swift\n    cardStack.dataSource = self\n    ```\n    \n3. Conform to `SwipeCardStackDelegate` to subscribe to any of the following events:\n\n   ```swift\n    func cardStack(_ cardStack: SwipeCardStack, didSelectCardAt index: Int)\n    func cardStack(_ cardStack: SwipeCardStack, didSwipeCardAt index: Int, with direction: SwipeDirection)\n    func cardStack(_ cardStack: SwipeCardStack, didUndoCardAt index: Int, from direction: SwipeDirection)\n    func didSwipeAllCards(_ cardStack: SwipeCardStack)\n   ```\n   \n   **Note**: `didSwipeCardAt` and `didSwipeAllCards`  are called regardless if a card is swiped programmatically or by the user.\n\n## Card Stack Actions\nThe following methods are available on `SwipeCardStack`.\n\n### Swipe\nPerforms a swipe programmatically in the given direction.\n\n```swift\nfunc swipe(_ direction: SwipeDirection, animated: Bool)\n```\n\n\u003cimg src=\"https://raw.githubusercontent.com/mac-gallagher/Shuffle/master/Assets/swipe.gif\" width=\"200\"\u003e\n\n### Shift\nShifts the card stack's cards by the given distance. Any swiped cards are skipped over.\n\n```swift\nfunc shift(withDistance distance: Int = 1, animated: Bool)\n```\n\n\u003cimg src=\"https://raw.githubusercontent.com/mac-gallagher/Shuffle/master/Assets/shift.gif\" width=\"200\"\u003e\n\n### Undo\nReturns the most recently swiped card to the top of the card stack.\n\n```swift\nfunc undoLastSwipe(animated: Bool)\n```\n\n\u003cimg src=\"https://raw.githubusercontent.com/mac-gallagher/Shuffle/master/Assets/undo.gif\" width=\"200\"\u003e\n\n## Card Layout\nEach `SwipeCard` consists of three UI components: its *content*, *footer*, and *overlay(s)*.\n\n### Content\nThe content is the card's primary view. You can include your own card template here.\n\n```swift\nvar content: UIView? { get set }\n```\n\n### Footer\nThe 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.\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/mac-gallagher/Shuffle/master/Assets/footer_layout.png\" width=\"700\"\u003e\n\u003c/p\u003e\n\n```swift\nvar footer: UIView? { get set }\nvar footerHeight: CGFloat { get set }\n```\n\n### Overlays\nAn 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. \n\n```swift\nfunc overlay(forDirection direction: SwipeDirection) -\u003e UIView?\nfunc setOverlay(_ overlay: UIView?, forDirection direction: SwipeDirection)\nfunc setOverlays(_ overlays: [SwipeDirection: UIView])\n```\n\n## Advanced Usage\nFor more advanced usage, including\n\n* [Animations](Documentation/AdvancedUsage.md#animations)\n* [Inserting and Deleting Cards](Documentation/AdvancedUsage.md#inserting-and-deleting-cards)\n* [Swipe Recognition](Documentation/AdvancedUsage.md#swipe-recognition)\n\nvisit the document [here](Documentation/AdvancedUsage.md).\n\n## Installation\n\n### CocoaPods\nShuffle is available through [CocoaPods](\u003chttps://cocoapods.org/\u003e). To install it, simply add the following line to your `Podfile`:\n\n\tpod 'Shuffle-iOS'\n\nThe import statement in this case will be\n\n```swift\nimport Shuffle_iOS\n```\n\n### Carthage\n\nShuffle is available through [Carthage](\u003chttps://github.com/Carthage/Carthage\u003e). To install it, simply add the following line to your Cartfile:\n\n\tgithub \"mac-gallagher/Shuffle\"\n\n### Swift Package Manager\nShuffle is available through [Swift PM](\u003chttps://swift.org/package-manager/\u003e). To install it, simply add the package as a dependency in `Package.swift`:\n\n```swift\ndependencies: [\n  .package(url: \"https://github.com/mac-gallagher/Shuffle.git\", from: \"0.1.0\"),\n]\n```\n\n### Manual\nDownload and drop the `Sources` directory into your project.\n\n## Requirements\n* iOS 9.0+\n* Xcode 10.2+\n* Swift 5.0+\n\n## Apps Using Shuffle\nWe love to hear about apps that use Shuffle - feel free to submit a pull request and share yours here!\n\n\u003cp\u003e\n\u003ca href=\"https://www.dropinapp.net\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/mac-gallagher/Shuffle/master/Assets/AppIcons/drop_in_app_icon.png\" title=\"Drop In for Fortnite\" width=\"80\" align=\"center\"\u003e\u003c/a\u003e\n\n\u003ca href=\"https://apps.apple.com/us/app/ovia-pregnancy-tracker/id719135369\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/mac-gallagher/Shuffle/master/Assets/AppIcons/ovia_app_icon.png\" title=\"Ovia Pregnancy Tracker\" width=\"80\" align=\"center\"\u003e\u003c/a\u003e\n\n\u003ca href=\"https://apps.apple.com/us/app/topface-dating-app-and-chat/id505446332\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/mac-gallagher/Shuffle/master/Assets/AppIcons/topface_app_icon.png\" title=\"Topface\" width=\"80\" align=\"center\"\u003e\u003c/a\u003e\n\n\u003ca href=\"https://apps.apple.com/bw/app/dankr/id1478419632\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/mac-gallagher/Shuffle/master/Assets/AppIcons/dankr_app_icon.png\" title=\"Dankr\" width=\"80\" align=\"center\"\u003e\u003c/a\u003e\n\n\u003ca href=\"https://apps.apple.com/us/app/id1516742129\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/mac-gallagher/Shuffle/master/Assets/AppIcons/eternal_app_icon.png\" title=\"Eternal\" width=\"80\" align=\"center\"\u003e\u003c/a\u003e\n\n\u003ca href=\"https://apps.apple.com/us/app/kanji-memo/id1552701832\"\u003e\n\u003cimg src=\"Assets/AppIcons/KanjiMemo_app_icon.png\" title=\"Kanji-Memo\" width=\"80\" align=\"center\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n\u003cp align=\"center\"\u003e\nMade with ❤️ by \u003ca href=\"https://github.com/mac-gallagher\"\u003eMac Gallagher\u003c/a\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmac-gallagher%2Fshuffle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmac-gallagher%2Fshuffle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmac-gallagher%2Fshuffle/lists"}