{"id":2894,"url":"https://github.com/younatics/YNExpandableCell","last_synced_at":"2025-08-06T16:32:14.190Z","repository":{"id":56929560,"uuid":"84613303","full_name":"younatics/YNExpandableCell","owner":"younatics","description":"✨ Awesome expandable, collapsible tableview cell for iOS written in Swift 4","archived":false,"fork":false,"pushed_at":"2019-10-15T14:42:57.000Z","size":24959,"stargazers_count":455,"open_issues_count":8,"forks_count":35,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-12-06T14:31:24.568Z","etag":null,"topics":["cell","collapsible","expandable","ios","swift3","tableview","tableviewcell"],"latest_commit_sha":null,"homepage":"https://www.cocoacontrols.com/controls/ynexpandablecell","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/younatics.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-11T00:56:17.000Z","updated_at":"2024-11-22T15:03:08.000Z","dependencies_parsed_at":"2022-08-20T23:20:08.256Z","dependency_job_id":null,"html_url":"https://github.com/younatics/YNExpandableCell","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/younatics%2FYNExpandableCell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/younatics%2FYNExpandableCell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/younatics%2FYNExpandableCell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/younatics%2FYNExpandableCell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/younatics","download_url":"https://codeload.github.com/younatics/YNExpandableCell/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228923747,"owners_count":17992573,"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":["cell","collapsible","expandable","ios","swift3","tableview","tableviewcell"],"created_at":"2024-01-05T20:16:25.670Z","updated_at":"2024-12-09T16:31:17.320Z","avatar_url":"https://github.com/younatics.png","language":"Swift","readme":"# USE [ExpandableCell](https://github.com/younatics/ExpandableCell). New version of this library.\n# YNExpandableCell\n\n[![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome)\n[![Version](https://img.shields.io/cocoapods/v/YNExpandableCell.svg?style=flat)](http://cocoapods.org/pods/YNExpandableCell)\n[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![CocoaPods](https://img.shields.io/cocoapods/metrics/doc-percent/YNExpandableCell.svg)](http://cocoadocs.org/docsets/YNExpandableCell)\n[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://github.com/younatics/YNExpandableCell/blob/master/LICENSE)\n[![Build Status](https://travis-ci.org/younatics/YNExpandableCell.svg?branch=master)](https://travis-ci.org/younatics/YNExpandableCell)\n[![Platform](https://img.shields.io/cocoapods/p/YNExpandableCell.svg?style=flat)](http://cocoapods.org/pods/YNExpandableCell)\n[![Swift 4.2](https://img.shields.io/badge/Swift-4.2-orange.svg?style=flat)](https://developer.apple.com/swift/)\n\n## Updates\nSee [CHANGELOG](https://github.com/younatics/YNExpandableCell/blob/master/CHANGELOG.md) for details\n\n## Intoduction\nEasiest usage of expandable \u0026 collapsible cell for iOS, written in Swift 4.2 You can customize expandable `UITableViewCell` whatever you like. `YNExpandableCell` is made because `insertRows` and `deleteRows` is hard to use. You can just inheirt `YNTableViewDelegate` and add one more method `func tableView(_ tableView: YNTableView, expandCellAt indexPath) -\u003e UITableViewCell?` \n\n![demo](Images/demo.gif)\n\n## Requirements\n\n`YNExpandableCell` written in Swift 3. Compatible with iOS 8.0+\n\n## Installation\n\n### Cocoapods\n\nYNExpandableCell is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod 'YNExpandableCell'\n```\n### Carthage\n```\ngithub \"younatics/YNExpandableCell\"\n```\n## Usage\n```swift\nimport YNExpandableCell\n```\n\nMake `YNTableView` in Storyboard or in code\n```swift\n@IBOutlet var ynTableView: YNTableView!\n```\n\nInherit `YNTableViewDelegate`\n```swift\nclass ViewController: UIViewController, YNTableViewDelegate \n```\n\nSet delegate and register cells\n```swift\nself.ynTableView.ynDelegate = self\n\nlet cells = [\"YNExpandableCellEx\",\"YNSliderCell\",\"YNSegmentCell\"]\nself.ynTableView.registerCellsWith(nibNames: cells, and: cells)\nself.ynTableView.registerCellsWith(cells: [UITableViewCell.self as AnyClass], and: [\"YNNonExpandableCell\"])\n```\n\n#### Use one of required method\nSet expandable cell in `YNTableViewDelegate` method (Required)\n```swift\nfunc tableView(_ tableView: YNTableView, expandCellAt indexPath: IndexPath) -\u003e UITableViewCell? {\n    let ynSliderCell = tableView.dequeueReusableCell(withIdentifier: YNSliderCell.ID) as! YNSliderCell\n    if indexPath.section == 0 \u0026\u0026 indexPath.row == 1 {\n        return ynSliderCell\n     }\n     return nil\n}\n```\n\nSet expandable cell with height in `YNTableViewDelegate` method using `YNTableViewCell` object (Required) \n```swift\nfunc tableView(_ tableView: YNTableView, expandCellWithHeightAt indexPath: IndexPath) -\u003e YNTableViewCell? {\n    let ynSliderCell = YNTableViewCell()\n    ynSliderCell.cell = tableView.dequeueReusableCell(withIdentifier: YNSliderCell.ID) as! YNSliderCell\n    ynSliderCell.height = 142\n\n    if indexPath.section == 0 \u0026\u0026 indexPath.row == 1 {\n        return ynSliderCell\n    }\n        return nil\n}\n```\n\nGet didSelectRowAt in `YNTableViewDelegate` method (Optional)\n```swift\nfunc tableView(_ tableView: YNTableView, didSelectRowAt indexPath: IndexPath, isExpandableCell: Bool, isExpandedCell: Bool) {\n    print(\"Selected Section: \\(indexPath.section) Row: \\(indexPath.row) isExpandableCell: \\(isExpandableCell) isExpandedCell: \\(isExpandedCell)\")\n}\n\n```\n\nGet didDeselectRowAt in `YNTableViewDelegate` method (Optional)\n```swift\nfunc tableView(_ tableView: YNTableView, didDeselectRowAt indexPath: IndexPath, isExpandableCell: Bool, isExpandedCell: Bool) {\n    print(\"Deselected Section: \\(indexPath.section) Row: \\(indexPath.row) isExpandableCell: \\(isExpandableCell) isExpandedCell: \\(isExpandedCell)\")\n}\n```\n\nSet basic `UITableViewDataSource`, `UITableViewDelegate` and Done!\n\n### Customize\n\nExpand \u0026 Collapse All if you want \n```swift\nself.ynTableView.expandAll()\nself.ynTableView.collapseAll()\n```\n\nInherit `YNExpandableCell` if you want awesome '+' '-' custom accessory type\n```swift\nclass YNExpandableCellEx: YNExpandableCell\n\n// Change normalCustomAccessoryType, selectedCustomAccessoryType Images\n```\n\nCutomize `UITableViewRowAnimation`\n```swift\nself.ynTableView.ynTableViewRowAnimation = UITableViewRowAnimation.top\n```\n\nMake Extensions for more `UITableViewDelegate` if you need or make pull request for me :)\n\n## References\n#### Please tell me or make pull request if you use this library in your application :) \n#### [@zigbang](https://github.com/zigbang)\n#### [MotionBook](https://github.com/younatics/MotionBook)\n## Author\n[younatics](https://twitter.com/younatics)\n\u003ca href=\"http://twitter.com/younatics\" target=\"_blank\"\u003e\u003cimg alt=\"Twitter\" src=\"https://img.shields.io/twitter/follow/younatics.svg?style=social\u0026label=Follow\"\u003e\u003c/a\u003e\n\n## License\nYNExpandableCell is available under the MIT license. See the LICENSE file for more info.\n","funding_links":[],"categories":["UI","Libs","TableView","UI [🔝](#readme)"],"sub_categories":["Table View / Collection View","UI","Other free courses"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyounatics%2FYNExpandableCell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyounatics%2FYNExpandableCell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyounatics%2FYNExpandableCell/lists"}