{"id":16685093,"url":"https://github.com/vberihuete/dcfilterview","last_synced_at":"2026-03-10T05:31:38.587Z","repository":{"id":56907152,"uuid":"147694509","full_name":"vberihuete/DCFilterView","owner":"vberihuete","description":"FilterView component developed by Dev Core Team. In here you will find a tab-like view to filter content","archived":false,"fork":false,"pushed_at":"2018-11-25T23:03:32.000Z","size":33,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-15T03:05:48.054Z","etag":null,"topics":["android-like","autolayout","cocoapods","filter","filtering","ios","stackview","swift","tabs","ui","uikit","uistackview","uitest"],"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/vberihuete.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":"2018-09-06T15:26:55.000Z","updated_at":"2021-06-04T11:22:53.000Z","dependencies_parsed_at":"2022-08-21T03:20:55.269Z","dependency_job_id":null,"html_url":"https://github.com/vberihuete/DCFilterView","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/vberihuete/DCFilterView","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vberihuete%2FDCFilterView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vberihuete%2FDCFilterView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vberihuete%2FDCFilterView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vberihuete%2FDCFilterView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vberihuete","download_url":"https://codeload.github.com/vberihuete/DCFilterView/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vberihuete%2FDCFilterView/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278903008,"owners_count":26065786,"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","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["android-like","autolayout","cocoapods","filter","filtering","ios","stackview","swift","tabs","ui","uikit","uistackview","uitest"],"created_at":"2024-10-12T14:46:00.050Z","updated_at":"2025-10-08T06:49:41.484Z","avatar_url":"https://github.com/vberihuete.png","language":"Swift","readme":"# DCFilterView\n[![CI Status](https://img.shields.io/travis/vberihuete/DCFilterView.svg?style=flat)](https://travis-ci.org/vberihuete/DCFilterView)\n[![Version](https://img.shields.io/cocoapods/v/DCFilterView.svg?style=flat)](https://cocoapods.org/pods/DCFilterView)\n[![License](https://img.shields.io/cocoapods/l/DCFilterView.svg?style=flat)](https://cocoapods.org/pods/DCFilterView)\n[![Platform](https://img.shields.io/cocoapods/p/DCFilterView.svg?style=flat)](https://cocoapods.org/pods/DCFilterView)\n\nA Stack View friendly filter view with a tab look and feel.\n\n![filter view demo](https://media.giphy.com/media/2UFU3FZOgZnnOmYtMz/giphy.gif)\n\nThis component is intendent to cover filter like solutions, not exactly View Controller (VC) changing type but content changing type in the same VC.\n\n## Example\n\nTo run the example project, clone the repo, and run `pod install` from the Example directory first. UI test are included so in order to see it working without throwing a line of code just run the UI test.\n\n## Installation\n\nDCFilterView is available through [CocoaPods](https://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod 'DCFilterView'\n```\n\n## How to\n\nAfter you have your cocoapods set up done and already added the pod for DCFilterView, you just need to import in the View Controller you will like to use the Filter View.\n\n```swift\nimport DCFilterView\n```\n\nThen add a Stack View to your View Controller, this being the one that will hold your content and the DCFilterView.\n\n```swift\n@IBOutlet weak var containerSV: UIStackView!\n```\n\nYou can declare a variable of type DCFilterView that will an instance of the Filter View (or do as you like!)\n\n```swift\nvar filterView: DCFilterView!\n```\n\nThen to give some structure to your DCFilterView you have the init\n\n```swift\nfilterView = DCFilterView(items: [\"Popular\", \"Related\", \"Oldest\"], color: .black, selectedColor: .red, selectedIndex: 1)\n```\n\nConstructor properties go as follows:\n\n* **items**: The String array of filters\n* **color**: The color for the unselected filters\n* **selectedColor**: The color for the selectedFilter\n* **selectedIndex**: The initial selected index (based on the items given in the items property)\n\nGo and add your recently created DCFilterView instance to your container stack view. \n\n```swift \nself.containerSV.insertArrangedSubview(filterView, at: 0)\n```\nAnd give to it some restrictions in height. e.g 40\n\n```swift\nself.containerSV.addConstraint(NSLayoutConstraint(item: self.filterView, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 1, constant: 40))\n```\nThat's it to make your Filter View visible.\n\nNote: In my case here I'm setting the filter view in the first position making it visible as a top filter view, but you can place it as you like.\n\n![filter view demo](https://media.giphy.com/media/2UFU3FZOgZnnOmYtMz/giphy.gif)\n\n### Giving it interaction\n\nIn order to react to filter change actions you need to implement the procotol **DCFilterViewDelegate** e.g.\n\n```swift\nextension ViewController: DCFilterViewDelegate{\n    \n    func dcFilterView(selected index: Int) {\n        print(\"filter selected at index \\(index)\")\n    }\n    \n}\n```\n\nYou can as well now call a direct selection to an item using the utility method\n```swift\nfilterView.markSelected(at: 2)\n```\nAlso consulting which index or item is selected, using read-only computed properties\n```swift\nfilterView.selected\nfilterView.selectedFilterViewItem\n```\n\nAnd as with all the delegation you are used to deal you will have to let your DCFilterView know that you want to be its delegate\n\n```swift \nfilterView.delegate = self\n```\n\nPD: Pull request are welcome, so feel free to download this and play with it.\n\n## Author\n\nVincent Berihuete, vberihuete@gmail.com\n\n## License\n\nDCFilterView is available under the MIT license. See the LICENSE file for more info.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvberihuete%2Fdcfilterview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvberihuete%2Fdcfilterview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvberihuete%2Fdcfilterview/lists"}