{"id":15037831,"url":"https://github.com/priteshrnandgaonkar/cardsstack","last_synced_at":"2025-06-11T05:32:49.220Z","repository":{"id":56905668,"uuid":"69112554","full_name":"priteshrnandgaonkar/CardsStack","owner":"priteshrnandgaonkar","description":"An awesome set of cards at your disposal  ✌️ ⚡️","archived":false,"fork":false,"pushed_at":"2016-11-25T10:37:34.000Z","size":16445,"stargazers_count":100,"open_issues_count":1,"forks_count":11,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-13T21:44:27.554Z","etag":null,"topics":["card","cardstack","carthage","cocoapods","collectionview","drag","ios","swift-3"],"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/priteshrnandgaonkar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-09-24T16:04:22.000Z","updated_at":"2025-03-23T13:24:04.000Z","dependencies_parsed_at":"2022-08-21T02:20:49.729Z","dependency_job_id":null,"html_url":"https://github.com/priteshrnandgaonkar/CardsStack","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/priteshrnandgaonkar%2FCardsStack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/priteshrnandgaonkar%2FCardsStack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/priteshrnandgaonkar%2FCardsStack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/priteshrnandgaonkar%2FCardsStack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/priteshrnandgaonkar","download_url":"https://codeload.github.com/priteshrnandgaonkar/CardsStack/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/priteshrnandgaonkar%2FCardsStack/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259207657,"owners_count":22821733,"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":["card","cardstack","carthage","cocoapods","collectionview","drag","ios","swift-3"],"created_at":"2024-09-24T20:35:56.249Z","updated_at":"2025-06-11T05:32:49.198Z","avatar_url":"https://github.com/priteshrnandgaonkar.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CardStack [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) ![Pod Support](https://img.shields.io/cocoapods/v/CardsStack.svg?maxAge=2592000) ![Swift 3 compatible](Documentation/Swift-3-orange.png)\n\n\nCardStack converts your `UICollectionView` to an awesome stack of cards using custom `UICollectionViewLayout`.\n\n## What is CardStack? 💫 ✨💥⭐️\n\nTalk is cheap, lets look at the gif. \n\n![Basic Interaction](Documentation/BasicCardStackInteraction.gif)\n\n\nThe Basic interaction with the CardStack is dragging up the cards till they are unraveled. But hold on, for the impatient users, there is one more interaction, you can drag a little and the cards will unwind or wind.\n\n![Lazy Interaction](Documentation/LazyInteraction.gif)\n\n## Installation\n### CocoaPods\n\n[CocoaPods](https://cocoapods.org/) is a dependency manager for Cocoa projects. You can install it with the following command:\n\n```\n$ gem install cocoapods\n\n```\nTo integrate CardsStack into your Xcode project using CocoaPods, specify it in your Podfile:\n\n```\nsource 'https://github.com/CocoaPods/Specs.git'\nplatform :ios, '8.0'\nuse_frameworks!\n\ntarget '\u003cYour Target Name\u003e' do\n    pod 'CardsStack', '0.2.1'\nend\n\n```\nThen, run the following command:\n\n```\n$ pod install\n\n```\n### Carthage\n[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.\n\nYou can install Carthage with [Homebrew](http://brew.sh/) using the following command:\n\n```\n$ brew update\n$ brew install carthage\n\n```\nTo integrate CardsStack into your Xcode project using Carthage, specify it in your Cartfile:\n\n```\ngithub \"priteshrnandgaonkar/CardsStack\" == 0.2.1\n\n```\nRun `carthage update` to build the framework and drag the built CardsStack.framework into your Xcode project.\n\n## How to use it?\n\nThere are 4 basic components required by CardsStack to function. To initialise the `CardStack` it needs the `CardsPosition`, `Configuration` along with `UICollectionView` and its height constraint i.e `NSLayoutConstraint`. \n\nInitialise `CardStack` as follows\n\n``` swift\nlet config = Configuration(cardOffset: 40, collapsedHeight: 200, expandedHeight: 500, cardHeight: 200, downwardThreshold: 20, upwardThreshold: 20, leftSpacing: 8.0, rightSpacing: 8.0, verticalSpacing: 8.0)\nlet cardStack = CardStack(cardsState: .Collapsed, configuration: config, collectionView: collectionView, collectionViewHeight: heightConstraint)\n\n```\n### Configuration\n\n`Configuration` object holds the information related to Stacks view, like the collapsed height, expanded height etc.\n\n``` swift\npublic struct Configuration {\n    public let cardOffset: Float\n    public let collapsedHeight:Float\n    public let expandedHeight:Float\n    public let cardHeight: Float\n    public let downwardThreshold: Float\n    public let upwardThreshold: Float\n    public let verticalSpacing: Float\n    public let leftSpacing: Float\n    public let rightSpacing: Float\n    \n    public init(cardOffset: Float, collapsedHeight: Float, expandedHeight: Float, cardHeight: Float, downwardThreshold: Float = 20, upwardThreshold: Float = 20, leftSpacing: Float = 8.0, rightSpacing: Float = 8.0, verticalSpacing: Float = 8.0) {\n        self.cardOffset = cardOffset\n        self.collapsedHeight = collapsedHeight\n        self.expandedHeight = expandedHeight\n        self.downwardThreshold = downwardThreshold\n        self.upwardThreshold = upwardThreshold\n        self.cardHeight = cardHeight\n        self.verticalSpacing = verticalSpacing\n        self.leftSpacing = leftSpacing\n        self.rightSpacing = rightSpacing\n    }\n}\n\n```\n\nIts initialiser requires the necessary fields like `cardOffset`, `collapsedHeight`, `expandedHeight` and `cardHeight`.\n\n1. `cardOffset` is the offset between thetwo cards while in collapsed state.\n2. `collapsedHeight`, as name suggests its the height of the collectionview while in collapsed state.\n3. `expandedHeight` is the height of the collectionview while in expanded state.\n4. `cardHeight` is the height of the cell.\n\n### CardsPosition\n\nIts an enum which states the current state of CardsStack.\n\n``` swift\n@objc public enum CardsPosition: Int {\n    case Collapsed\n    case Expanded\n}\n\n```\n\n## CardsManagerDelegate\n\nWith this delegate you can get the hooks to specific events.\n\n``` swift\n\n@objc public protocol CardsManagerDelegate {\n    \n    @objc optional func cardsPositionChangedTo(position: CardsPosition)\n    @objc optional func tappedOnCardsStack(cardsCollectionView: UICollectionView)\n    @objc optional func cardsCollectionView(_ cardsCollectionView: UICollectionView, didSelectItemAt indexPath: IndexPath)\n    @objc optional func cardsCollectionView(_ cardsCollectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath)\n    \n}\n\n```\nFor listening to this call-backs assign a delegate to `CardsStack`.\n\n``` swift\ncardStack.delegate = self\n```\n\nThe last two functions are the same as the delegate function for collection view.\n\nThe first function gives the hook to the `CardStacks` position change.\n\n``` swift\n@objc optional func cardsPositionChangedTo(position: CardsPosition) \n```\n\nThe CardStack also has the tap gesture which is enabled when the cards are collapsed.The second function gives the hook to the tap gesture on collectionview when the cards are in collapsed state.\n\nSo you can use this hook to open cards, like this\n\n``` swift\n\nfunc tappedOnCardsStack(cardsCollectionView: UICollectionView) {\n        cardStack.changeCardsPosition(to: .Expanded)\n    }\n\n```\n\nIn order to change the state of the cards programatically you can use.\n\n``` swift\npublic func changeCardsPosition(to position: CardsPosition) {\n\n```\n\nYou can checkout the example in the project and play around with it to get hang of the API's.\n\nYou can also find the [example](https://github.com/priteshrnandgaonkar/CardsStackExample) with CardsStack imported through Carthage.\n\nYou can also checkout the my [blog](https://priteshrnandgaonkar.github.io/Details-of-CardsStack/) discussing the details of the library.\n\n## TODO\n- [x] Carthage Support\n- [x] CocoaPods Support\n- [ ] SwiftPM Support\n- [ ] Watch, TvOS Targets \n\n## Contributions\n\nFound a bug? Want a new feature? Please feel free to report any issue or raise a Pull Request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpriteshrnandgaonkar%2Fcardsstack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpriteshrnandgaonkar%2Fcardsstack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpriteshrnandgaonkar%2Fcardsstack/lists"}