{"id":15066959,"url":"https://github.com/ramotion/folding-cell","last_synced_at":"2025-05-13T19:15:27.210Z","repository":{"id":37285765,"uuid":"48376164","full_name":"Ramotion/folding-cell","owner":"Ramotion","description":":octocat: 📃 FoldingCell is an expanding content cell with animation made by @Ramotion","archived":false,"fork":false,"pushed_at":"2024-04-28T23:42:52.000Z","size":23548,"stargazers_count":10241,"open_issues_count":12,"forks_count":1143,"subscribers_count":267,"default_branch":"master","last_synced_at":"2025-04-28T01:44:58.941Z","etag":null,"topics":["animation","ios","library","material-design","swift","ui"],"latest_commit_sha":null,"homepage":"https://www.ramotion.com/folding-cell/","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/Ramotion.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2015-12-21T14:29:48.000Z","updated_at":"2025-04-23T08:42:06.000Z","dependencies_parsed_at":"2024-06-18T16:49:16.228Z","dependency_job_id":"4797a1fe-f0a7-4070-810e-d4500255d9d5","html_url":"https://github.com/Ramotion/folding-cell","commit_stats":{"total_commits":328,"total_committers":27,"mean_commits":"12.148148148148149","dds":0.6463414634146342,"last_synced_commit":"620eda3030ff2f50a97288498482c7d577ab9594"},"previous_names":[],"tags_count":51,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ramotion%2Ffolding-cell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ramotion%2Ffolding-cell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ramotion%2Ffolding-cell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ramotion%2Ffolding-cell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ramotion","download_url":"https://codeload.github.com/Ramotion/folding-cell/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254010821,"owners_count":21999002,"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":["animation","ios","library","material-design","swift","ui"],"created_at":"2024-09-25T01:14:31.714Z","updated_at":"2025-05-13T19:15:27.150Z","avatar_url":"https://github.com/Ramotion.png","language":"Swift","readme":"\u003ca href=\"https://www.ramotion.com/agency/app-development/?utm_source=gthb\u0026utm_medium=repo\u0026utm_campaign=folding-cell\"\u003e\u003cimg src=\"https://github.com/Ramotion/folding-cell/blob/master/header.png\"\u003e\u003c/a\u003e\n\n\u003ca href=\"https://github.com/Ramotion/folding-cell\"\u003e\n\u003cimg align=\"left\" src=\"https://github.com/Ramotion/folding-cell/blob/master/Screenshots/foldingCell.gif\" width=\"480\" height=\"360\" /\u003e\u003c/a\u003e\n\n\u003cp\u003e\u003ch1 align=\"left\"\u003eFOLDING CELL\u003c/h1\u003e\u003c/p\u003e\n\n\u003ch4\u003eExpanding content cell with animation inspired by folding paper card material design.\u003c/h4\u003e\n\n\n___\n\n\n\n\u003cp\u003e\u003ch6\u003eWe specialize in the designing and coding of custom UI for Mobile Apps and Websites.\u003c/h6\u003e\n\u003ca href=\"https://www.ramotion.com/agency/app-development/?utm_source=gthb\u0026utm_medium=repo\u0026utm_campaign=folding-cell\"\u003e\n\u003cimg src=\"https://github.com/ramotion/gliding-collection/raw/master/contact_our_team@2x.png\" width=\"187\" height=\"34\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\u003cp\u003e\u003ch6\u003eStay tuned for the latest updates:\u003c/h6\u003e\n\u003ca href=\"https://goo.gl/rPFpid\" \u003e\n\u003cimg src=\"https://i.imgur.com/ziSqeSo.png/\" width=\"156\" height=\"28\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003c/br\u003e\n\n[![CocoaPods](https://img.shields.io/cocoapods/p/FoldingCell.svg)](https://cocoapods.org/pods/FoldingCell)\n[![CocoaPods](https://img.shields.io/cocoapods/v/FoldingCell.svg)](http://cocoapods.org/pods/FoldingCell)\n[![Twitter](https://img.shields.io/badge/Twitter-@Ramotion-blue.svg?style=flat)](http://twitter.com/Ramotion)\n[![Travis](https://img.shields.io/travis/Ramotion/folding-cell.svg)](https://travis-ci.org/Ramotion/folding-cell)\n[![codebeat badge](https://codebeat.co/badges/6f67da5d-c416-4bac-9fb7-c2dc938feedc)](https://codebeat.co/projects/github-com-ramotion-folding-cell)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![Swift 4.0](https://img.shields.io/badge/Swift-5.0-green.svg?style=flat)](https://developer.apple.com/swift/)\n[![Analytics](https://ga-beacon.appspot.com/UA-84973210-1/ramotion/folding-cell)](https://github.com/igrigorik/ga-beacon)\n[![Donate](https://img.shields.io/badge/Donate-PayPal-blue.svg)](https://paypal.me/Ramotion)\n\n## Requirements\n\n- iOS 8.0+\n- Xcode 10.2\n\n## Installation\n\nJust add the FoldingCell.swift file to your project.\n\nor use [CocoaPods](https://cocoapods.org) with Podfile:\n```\npod 'FoldingCell'\n```\nor [Carthage](https://github.com/Carthage/Carthage) users can simply add Mantle to their `Cartfile`:\n```\ngithub \"Ramotion/folding-cell\"\n```\nor [Swift Package Manager](https://swift.org/package-manager/) by adding:\n```\ndependencies: [\n.package(url: \"https://github.com/Ramotion/folding-cell.git\", from: \"5.0.2\")\n]\n```\nto `Package.swift`\n\nor just drag and drop FoldingCell.swift file to your project\n\n## Solution\n![Solution](https://raw.githubusercontent.com/Ramotion/folding-cell/master/Tutorial-resources/Solution.png)\n## Usage\n\n1) Create a new cell inheriting from `FoldingCell`\n\n2) Add a UIView to your cell in your storyboard or nib file, inheriting from `RotatedView`.\nConnect the outlet from this view to the cell property `foregroundView`.\nAdd constraints from this view to the superview, as in this picture:\n\n![1.1](https://raw.githubusercontent.com/Ramotion/folding-cell/master/Tutorial-resources/1.1.png)\n\n(constants of constraints may be different). Connect the outlet from this top constraint to the cell property `foregroundViewTop`\n. (This view will be shown when the cell is in its normal state).\n\n3) Add other UIViews to your cell, connect the outlet from this view to the cell\nproperty `containerView`. Add constraints from this view to the superview like in the picture:\n\n![1.2](https://raw.githubusercontent.com/Ramotion/folding-cell/master/Tutorial-resources/1.2.png)\n\n(constants of constraints may be different). Connect the outlet from this top constraint to the cell property `containerViewTop`.\n(This view will be shown when the cell is opened)\n\nYour result should be something like this picture:\n\n![1.3](https://raw.githubusercontent.com/Ramotion/folding-cell/master/Tutorial-resources/1.3.png)\n\n\n4) Set ``` @IBInspectable var itemCount: NSInteger ``` property is a count of folding (it IBInspectable you can set in storyboard). range 2 or greater. Default value is 2\n\nOk, we've finished configuring the cell.\n\n5) Adding code to your UITableViewController\n\n5.1) Add constants:\n``` swift\nfileprivate struct C {\n  struct CellHeight {\n    static let close: CGFloat = *** // equal or greater foregroundView height\n    static let open: CGFloat = *** // equal or greater containerView height\n  }\n}\n```\n5.2) Add property for calculate cells height\n\n``` swift\n     var cellHeights = (0..\u003cCELLCOUNT).map { _ in C.CellHeight.close }\n```\n\n5.3) Override method:\n``` swift\n    override func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -\u003e CGFloat {\n        return cellHeights[indexPath.row]\n    }\n```\n\n5.4) Added code to method:\n``` swift\n    override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {\n        guard case let cell as FoldingCell = tableView.cellForRowAtIndexPath(indexPath) else {\n          return\n        }\n\n        var duration = 0.0\n        if cellIsCollapsed {\n            cellHeights[indexPath.row] = Const.openCellHeight\n            cell.unfold(true, animated: true, completion: nil)\n            duration = 0.5\n        } else {\n            cellHeights[indexPath.row] = Const.closeCellHeight\n            cell.unfold(false, animated: true, completion: nil)\n            duration = 0.8\n        }\n\n        UIView.animateWithDuration(duration, delay: 0, options: .CurveEaseOut, animations: { _ in\n            tableView.beginUpdates()\n            tableView.endUpdates()\n        }, completion: nil)\n    }\n```\n5.5) Control if the cell is open or closed\n``` swift\n  override func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {\n\n        if case let cell as FoldingCell = cell {\n            if cellHeights![indexPath.row] == C.cellHeights.close {\n                foldingCell.selectedAnimation(false, animated: false, completion:nil)\n            } else {\n                foldingCell.selectedAnimation(true, animated: false, completion: nil)\n            }\n        }\n    }\n```\n\n6) Add this code to your new cell class\n``` swift\n    override func animationDuration(itemIndex:NSInteger, type:AnimationType)-\u003e NSTimeInterval {\n\n        // durations count equal it itemCount\n        let durations = [0.33, 0.26, 0.26] // timing animation for each view\n        return durations[itemIndex]\n    }\n```\n\n## if don't use storyboard and xib files\n\nCreate foregroundView and containerView from code (steps 2 - 3) look example:\n[Folding-cell-programmatically](https://github.com/ober01/Folding-cell-programmatically)\n\n## 🗂 Check this library on other language:\n\u003ca href=\"https://github.com/Ramotion/folding-cell-android\"\u003e\n\u003cimg src=\"https://github.com/ramotion/navigation-stack/raw/master/Android_Java@2x.png\" width=\"178\" height=\"81\"\u003e\u003c/a\u003e\n\n\n## 📄 License\n\nFolding cell is released under the MIT license.\nSee [LICENSE](./LICENSE) for details.\n\nThis library is a part of a \u003ca href=\"https://github.com/Ramotion/swift-ui-animation-components-and-libraries\"\u003e\u003cb\u003eselection of our best UI open-source projects.\u003c/b\u003e\u003c/a\u003e\n\nIf you use the open-source library in your project, please make sure to credit and backlink to https://www.ramotion.com/\n\n## 📱 Get the Showroom App for iOS to give it a try\nTry this UI component and more like this in our iOS app. Contact us if interested.\n\n\u003ca href=\"https://itunes.apple.com/app/apple-store/id1182360240?pt=550053\u0026ct=folding-cell\u0026mt=8\" \u003e\n\u003cimg src=\"https://github.com/ramotion/gliding-collection/raw/master/app_store@2x.png\" width=\"117\" height=\"34\"\u003e\u003c/a\u003e\n\n\u003ca href=\"https://www.ramotion.com/agency/app-development/?utm_source=gthb\u0026utm_medium=repo\u0026utm_campaign=folding-cell\"\u003e\n\u003cimg src=\"https://github.com/ramotion/gliding-collection/raw/master/contact_our_team@2x.png\" width=\"187\" height=\"34\"\u003e\u003c/a\u003e\n","funding_links":["https://paypal.me/Ramotion"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Framotion%2Ffolding-cell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Framotion%2Ffolding-cell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Framotion%2Ffolding-cell/lists"}