{"id":15561327,"url":"https://github.com/alicanbatur/abexpandableview","last_synced_at":"2025-04-14T10:33:14.998Z","repository":{"id":56900106,"uuid":"114239249","full_name":"alicanbatur/ABExpandableView","owner":"alicanbatur","description":"Expandable, collapsible, filterable and single/multi selectable table view.","archived":false,"fork":false,"pushed_at":"2019-11-17T09:10:27.000Z","size":72,"stargazers_count":136,"open_issues_count":2,"forks_count":12,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-08T11:38:29.596Z","etag":null,"topics":["cocoapod","cocoapods","collapsible","expandable","filterable","ios","mvvm","pod","protocol","protocol-oriented-programming","reusable","searchbar","selectable","swift","swift4","tableview","ui","ui-components","uicomponent"],"latest_commit_sha":null,"homepage":null,"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/alicanbatur.png","metadata":{"files":{"readme":"README.md","changelog":null,"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-12-14T10:53:29.000Z","updated_at":"2025-02-24T06:08:55.000Z","dependencies_parsed_at":"2022-08-20T18:20:38.412Z","dependency_job_id":null,"html_url":"https://github.com/alicanbatur/ABExpandableView","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alicanbatur%2FABExpandableView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alicanbatur%2FABExpandableView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alicanbatur%2FABExpandableView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alicanbatur%2FABExpandableView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alicanbatur","download_url":"https://codeload.github.com/alicanbatur/ABExpandableView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248862958,"owners_count":21173907,"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":["cocoapod","cocoapods","collapsible","expandable","filterable","ios","mvvm","pod","protocol","protocol-oriented-programming","reusable","searchbar","selectable","swift","swift4","tableview","ui","ui-components","uicomponent"],"created_at":"2024-10-02T16:07:27.265Z","updated_at":"2025-04-14T10:33:14.952Z","avatar_url":"https://github.com/alicanbatur.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ABExpandableView\n\n[![CI Status](http://img.shields.io/travis/alicanbatur/ABExpandableView.svg?style=flat)](https://travis-ci.org/alicanbatur/ABExpandableView)\n[![Version](https://img.shields.io/cocoapods/v/ABExpandableView.svg?style=flat)](http://cocoapods.org/pods/ABExpandableView)\n[![License](https://img.shields.io/cocoapods/l/ABExpandableView.svg?style=flat)](http://cocoapods.org/pods/ABExpandableView)\n[![Platform](https://img.shields.io/cocoapods/p/ABExpandableView.svg?style=flat)](http://cocoapods.org/pods/ABExpandableView)\n\n\n\u003ca href=\"https://gfycat.com/RipeUnhappyDamselfly\"\u003e\u003cimg src=\"https://thumbs.gfycat.com/RipeUnhappyDamselfly-size_restricted.gif\"/\u003e\u003c/a\u003e\n\n\n## Example\n\nTo run the example project, clone the repo, and run `pod install` from the Example directory first. Then run `ABExpandableView.xcworkspace` which is under `/Example` folder.\n\n## Requirements\n  - Swift 4\n  - Xcode 9\n   \n## Installation\n\nABExpandableView is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod 'ABExpandableView'\n```\n## Usage\n\nFirst, import `ABExpandableView` to your project.\n\nYou should have 2 kinds of model objects to use this view that one of them should be section and the other one should be row.\n\nConsider, Section and Row classes are your objects.\n\n```swift\nclass Section: SectionItem {\n    var identifier: String!\n    var name: String!\n    \n    var expanded: Bool = true\n    \n    var rows: [RowItem] = [RowItem]()\n    var rawRows: [RowItem] = [RowItem]() {\n        didSet {\n            rows = rawRows\n        }\n    }\n    var selectedRows: [RowItem] = [RowItem]()\n}\n\nclass Row: RowItem {\n    var identifier: String!\n    var name: String!\n}\n\nclass MockDataProvider {\n    \n    class func createMockData() -\u003e [SectionItem] {\n        var array = [SectionItem]()\n        \n        let izmir = City()\n        izmir.identifier = \"35\"\n        izmir.name = \"İzmir\"\n        let bornova = Town(identifier: \"1\", name: \"Bornova\")\n        let urla = Town(identifier: \"2\", name: \"Urla\")\n        let konak = Town(identifier: \"3\", name: \"Konak\")\n        let izmirRawRows = [bornova, urla, konak]\n        izmir.rawRows = izmirRawRows\n        array.append(izmir)\n        \n        let istanbul = City()\n        istanbul.identifier = \"34\"\n        istanbul.name = \"İstanbul\"\n        let kadikoy = Town(identifier: \"4\", name: \"Kadıköy\")\n        let maltepe = Town(identifier: \"5\", name: \"Maltepe\")\n        let beykoz = Town(identifier: \"6\", name: \"Beykoz\")\n        let istanbulRawRows = [kadikoy, maltepe, beykoz]\n        istanbul.rawRows = istanbulRawRows\n        array.append(istanbul)\n        \n        return array\n    }\n    \n}\n```\n\nAfter you create your models, you should open ABExpandableView with injecting those model array.\n\n```swift\n@IBAction func buttonTapped(_ sender: Any) {\n        let cities = MockDataProvider.createMockData()\n        let expandableSectionsViewModel = ExpandableSectionsViewModel(cities)\n        let expandableSectionViewController = ExpandableSectionsViewController.newInstance(expandableSectionsViewModel)\n        expandableSectionViewController.title = \"Choose Town(s)\"\n        expandableSectionViewController.delegate = self\n        self.navigationController?.pushViewController(expandableSectionViewController, animated: true)\n    }\n```\n\nHere, let ABExpandableView handle the rest.\n\nOne last thing;\nYou can get selected items using the delegation;\n\n```swift \n    func didSelectItems(_ items: [RowItem]) {\n        let names = items.flatMap { $0.name }.joined(separator: \", \")\n        // \"Bornova, Kadıköy\"\n    }\n```\n\n## Author\n\nalicanbatur, alicanbatur@gmail.com\n\n## License\n\nABExpandableView is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falicanbatur%2Fabexpandableview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falicanbatur%2Fabexpandableview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falicanbatur%2Fabexpandableview/lists"}