{"id":2867,"url":"https://github.com/dimpiax/FlexibleCollectionViewController","last_synced_at":"2025-08-03T12:31:34.898Z","repository":{"id":56911419,"uuid":"60076396","full_name":"dimpiax/FlexibleCollectionViewController","owner":"dimpiax","description":"Generic collection view controller with external data processing","archived":false,"fork":false,"pushed_at":"2017-01-19T18:54:08.000Z","size":60,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-02T04:22:58.705Z","etag":null,"topics":["collectionview","flexible","indexpath","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/dimpiax.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":"2016-05-31T09:31:07.000Z","updated_at":"2023-12-07T17:29:17.000Z","dependencies_parsed_at":"2022-08-20T20:20:37.445Z","dependency_job_id":null,"html_url":"https://github.com/dimpiax/FlexibleCollectionViewController","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimpiax%2FFlexibleCollectionViewController","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimpiax%2FFlexibleCollectionViewController/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimpiax%2FFlexibleCollectionViewController/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimpiax%2FFlexibleCollectionViewController/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dimpiax","download_url":"https://codeload.github.com/dimpiax/FlexibleCollectionViewController/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228543165,"owners_count":17934436,"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":["collectionview","flexible","indexpath","swift-3"],"created_at":"2024-01-05T20:16:24.948Z","updated_at":"2024-12-07T00:31:02.750Z","avatar_url":"https://github.com/dimpiax.png","language":"Swift","funding_links":[],"categories":["UI"],"sub_categories":["Table View / Collection View","Layout","Other free courses"],"readme":"# FlexibleCollectionViewController\n\n[![Language](https://img.shields.io/badge/swift-3.0-fec42e.svg)](https://swift.org/blog/swift-3-0-released/)\n[![Version](https://img.shields.io/cocoapods/v/FlexibleCollectionViewController.svg?style=flat)](http://cocoapods.org/pods/FlexibleCollectionViewController)\n[![License](https://img.shields.io/cocoapods/l/FlexibleCollectionViewController.svg?style=flat)](http://cocoapods.org/pods/FlexibleCollectionViewController)\n[![Platform](https://img.shields.io/cocoapods/p/FlexibleCollectionViewController.svg?style=flat)](http://cocoapods.org/pods/FlexibleCollectionViewController)\n\nSwift library of generic collection view controller with external data processing of functionality,\nlike determine cell's `reuseIdentifier` related to `indexPath`, \nconfiguration of requested cell for display and cell selection handler etc\n\n## Example\n\nInitialisation with configuration \n```swift\n_flexibleCollectionVC = FlexibleCollectionViewController(collectionViewLayout: CustomFlowLayout(), configuration: CollectionConfiguration(userInteractionEnabled: true, showsHorizontalScrollIndicator: false, isScrollEnabled: true, multipleTouchEnabled: false, backgroundColor: .clear))\n```\n\nCell and supplementary view registering\n```swift\n_flexibleCollectionVC.register(UICollectionViewCell.self, forCellWithReuseIdentifier: \"UICollectionViewCell\")\n_flexibleCollectionVC.registerSupplementaryView(UIHeaderImageCollectionView.self, kind: .header, reuseIdentifier: UIHeaderImageCollectionView.reuseIdentifier)\n```\n\nRequesting indentifier of cell for specific indexPath\n```swift\n_flexibleCollectionVC.requestCellIdentifier = { value in\n  return \"UICollectionViewCell\"\n}\n```\n\nRequesting indentifier of supplementary view for specific indexPath\n```swift\n_flexibleCollectionVC.requestSupplementaryIdentifier = { value in\n  return UIHeaderImageCollectionView.reuseIdentifier\n}\n```\n\nConfiguration of input cell with related data to indexPath\n```swift\n_flexibleCollectionVC.configureCell = { (cell: UICollectionViewCell, data: CollectionImageCellData?, indexPath: IndexPath) in\n  guard let data = data else {\n    return false\n  }\n\n  cell.backgroundColor = data.color\n\n  return true\n}\n```\n\nConfiguration of supplementary view with related kind and data to indexPath\n```swift\n_flexibleCollectionVC.configureSupplementary = { (view: UICollectionReusableView, kind: SupplementaryKind, data: CollectionImageCellData?, indexPath: IndexPath) in\n  if let view = view as? UIHeaderImageCollectionView, let data = data {\n    view.text = data.category\n\n    return true\n  }\n\n  return false\n}\n```\n\nProcess cell selection to related indexPath\n```swift\n_flexibleCollectionVC.cellDidSelect = { value in\n  return (deselect: true, animate: true)\n}\n```\n\nEstimate cell size\n```swift\n_flexibleCollectionVC.estimateCellSize = { value in\n  guard let layout = value.1 as? UICollectionViewFlowLayout else {\n    return nil\n  }\n\n  let col: CGFloat = 3\n  let width = value.0.bounds.width-(layout.sectionInset.left+layout.sectionInset.right)\n  let side = round(width/col)-layout.minimumInteritemSpacing\n  return CGSize(width: side, height: side)\n}\n```\n\nPut predefined cells in generated order related to ListGenerator\n```swift\n_flexibleCollectionVC.setData(getData())\n```\n\n## Requirements\n\nSwift 3 or above\n\n## Installation\n\nFlexibleCollectionViewController is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod \"FlexibleCollectionViewController\"\n```\n\n## Author\n\nPilipenko Dima, dimpiax@gmail.com\n\n## License\n\nFlexibleCollectionViewController 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%2Fdimpiax%2FFlexibleCollectionViewController","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdimpiax%2FFlexibleCollectionViewController","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimpiax%2FFlexibleCollectionViewController/lists"}