{"id":26382898,"url":"https://github.com/minikin/itemsdatasource","last_synced_at":"2025-03-17T06:19:24.845Z","repository":{"id":56915612,"uuid":"114106222","full_name":"minikin/ItemsDataSource","owner":"minikin","description":":recycle: Generic datasource for UICollectionView","archived":false,"fork":false,"pushed_at":"2024-04-23T11:38:45.000Z","size":5955,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-08T17:54:24.316Z","etag":null,"topics":["carthage","cocoapods","generic-programming","ios","swift","swift5","uicollectionview"],"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/minikin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-12-13T10:19:48.000Z","updated_at":"2024-04-23T11:38:49.000Z","dependencies_parsed_at":"2024-04-23T13:03:33.456Z","dependency_job_id":null,"html_url":"https://github.com/minikin/ItemsDataSource","commit_stats":{"total_commits":52,"total_committers":1,"mean_commits":52.0,"dds":0.0,"last_synced_commit":"6c556e787b12f98a8f38778675d90e8286da0643"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minikin%2FItemsDataSource","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minikin%2FItemsDataSource/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minikin%2FItemsDataSource/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minikin%2FItemsDataSource/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/minikin","download_url":"https://codeload.github.com/minikin/ItemsDataSource/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243982267,"owners_count":20378607,"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":["carthage","cocoapods","generic-programming","ios","swift","swift5","uicollectionview"],"created_at":"2025-03-17T06:19:24.167Z","updated_at":"2025-03-17T06:19:24.824Z","avatar_url":"https://github.com/minikin.png","language":"Swift","readme":"# ItemsDataSource\n\n[![Build Status](https://travis-ci.org/minikin/ItemsDataSource.svg?branch=master)](https://travis-ci.org/minikin/ItemsDataSource)\n[![CocoaPods](https://img.shields.io/cocoapods/v/ItemsDataSource.svg)](https://cocoapods.org/pods/ItemsDataSource)\n[![Platform](https://img.shields.io/cocoapods/p/ItemsDataSource.svg?style=flat)](https://github.com/minikin/ItemsDataSource)\n\n\u003cimg src=\"https://github.com/minikin/ItemsDataSource/blob/master/demo.gif?raw=true\" width=300 /\u003e\n\nItemsDataSource is a generic datasource for UICollectionView.\n\n- [Features](#features)\n- [Requirements](#requirements)\n- [Installation](#installation)\n- [Usage](#usage)\n- [License](#license)\n\n## Features\n\n- Create collections with any data types\n- Reusable UICollectionViewCell and UICollectionReusableView\n- UICollectionView at its core\n- Easy extendable\n\n## Requirements\n\n- iOS 10.0+\n- Xcode 9.0+\n- Swift 5.0+\n\n## Installation\n\n### CocoaPods\n\n[CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command:\n\n```bash\n$ gem install cocoapods\n```\n\n\u003e CocoaPods 1.1+ is required to build ItemsDataSource.\n\nTo integrate ItemsDataSource into your Xcode project using CocoaPods, specify it in your `Podfile`:\n\n```ruby\nsource 'https://github.com/CocoaPods/Specs.git'\nplatform :ios, '10.0'\nuse_frameworks!\n\ntarget '\u003cYour Target Name\u003e' do\n    pod 'ItemsDataSource'\nend\n```\n\nif you're using `CocoaPods 1.5.0+` you can include `ItemsDataSource` as static library:\n\n```ruby\nsource 'https://github.com/CocoaPods/Specs.git'\nplatform :ios, '10.0'\n\ntarget '\u003cYour Target Name\u003e' do\n    pod 'ItemsDataSource'\nend\n```\n\nThen, run the following command:\n\n```bash\n$ pod install\n```\n\n### Carthage\n\n[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.\n\nYou can install Carthage with [Homebrew](http://brew.sh/) using the following command:\n\n```bash\n$ brew update\n$ brew install carthage\n```\n\nTo integrate ItemsDataSource into your Xcode project using Carthage, specify it in your `Cartfile`:\n\n```ogdl\ngithub \"ItemsDataSource\"\n```\n\nRun `carthage update` to build the framework and drag the built `ItemsDataSource.framework` into your Xcode project.\n\n### Manually\n\nIf you prefer not to use any of the aforementioned dependency managers, you can integrate ItemsDataSource into your project manually.\nJust copy files from `Sources` folder to your projects:\n\n```swift\n\nCellDescriptor.swift\nGroupable.swift\nItemable.swift\nItemsDataSource.swift\nSupplementaryDescriptor.swift\n```\n\n## Usage\n\nDefine your model as usual\n\n```swift\nimport UIKit\nimport ItemsDataSource\n\nstruct Vitamin {\n\n  // MARK: - Instance Properties\n\n  let name: String\n  let amount: Double\n}\n```\n\nConform your model to `Itemable`\n\n```swift\n\nextension Vitamin: Itemable {\n  var itemCellDescriptor: CellDescriptor {\n    return CellDescriptor(reuseIdentifier: ReuseIdentifier.vitaminCell, configure: configureIngredientCell)\n  }\n}\n\n```\n\nAdd `configure` method to model in extension\n\n```swift\nextension Vitamin {\n  func configureIngredientCell(_ cell: ViataminCell) {\n    cell.vitaminNameLabel.text = name\n    cell.backgroundColor = UIColor.randomColor()\n  }\n}\n```\n\nIn ViewController inject your datasource\n\n```swift\n\nimport ItemsDataSource\nimport UIKit\n\nfinal class ExampleViewController: UIViewController {\n\n  // MARK: - Injections\n\n  public var vitaminsDataSourse = ItemsDataSource(items: [Vitamin](),\n                                                  cellDescriptor: { $0.itemCellDescriptor })\n\n  // MARK: - IBOutlets\n\n  @IBOutlet var exampleCollectionView: UICollectionView! {\n    didSet {\n      setExampleCollectionViewDataSource()\n      exampleCollectionView.delegate = self\n      setExampleCollectionViewLayout()\n      exampleCollectionView.reloadData()\n    }\n  }\n\n  // MARK: - Instance Properties\n\n  var vitamins = [Vitamin]()\n\n  // MARK: - ViewController LifeCycle\n\n  override func viewDidLoad() {\n    super.viewDidLoad()\n    print(\"vitamins\", vitamins)\n  }\n\n  // MARK: - Helpers\n\n  private func setExampleCollectionViewDataSource() {\n    vitaminsDataSourse.items = vitamins\n    exampleCollectionView.dataSource = vitaminsDataSourse\n  }\n\n  private func setExampleCollectionViewLayout() {\n    let layout = CommonFlowLayout(columns: 2,\n                                  itemHeight: 200,\n                                  inset: 5,\n                                  spacing: 0,\n                                  lineSpacing: 5)\n    exampleCollectionView.collectionViewLayout = layout\n  }\n}\n\n// MARK: - UICollectionViewDelegate\n\nextension ExampleViewController: UICollectionViewDelegate {}\n```\n\nFor more details, please check an iOS example.\n\n## Support\n\nPost issues and feature requests on the GitHub [issue tracker](https://github.com/minikin/ItemsDataSource/issues).\n\n## License\n\nItemsDataSource is released under the MIT license. [See LICENSE](https://github.com/minikin/ItemsDataSource/blob/master/LICENSE) for details.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fminikin%2Fitemsdatasource","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fminikin%2Fitemsdatasource","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fminikin%2Fitemsdatasource/lists"}