{"id":16482764,"url":"https://github.com/shaps80/cellprovider","last_synced_at":"2026-05-10T12:02:44.796Z","repository":{"id":56905747,"uuid":"65076519","full_name":"shaps80/CellProvider","owner":"shaps80","description":"A generic cell provider implementation in Swift","archived":false,"fork":false,"pushed_at":"2017-02-28T00:41:12.000Z","size":85,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-12T01:17:15.006Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://shaps.me/blog/cells-providers/","language":"Shell","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/shaps80.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-08-06T10:01:29.000Z","updated_at":"2017-02-28T00:08:36.000Z","dependencies_parsed_at":"2022-08-21T03:20:44.731Z","dependency_job_id":null,"html_url":"https://github.com/shaps80/CellProvider","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaps80%2FCellProvider","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaps80%2FCellProvider/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaps80%2FCellProvider/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaps80%2FCellProvider/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shaps80","download_url":"https://codeload.github.com/shaps80/CellProvider/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241214587,"owners_count":19928337,"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":[],"created_at":"2024-10-11T13:11:55.988Z","updated_at":"2026-05-10T12:02:39.748Z","avatar_url":"https://github.com/shaps80.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CellProvider\n\n[![Version](https://img.shields.io/cocoapods/v/CellProvider.svg?style=flat)](http://cocoapods.org/pods/CellProvider)\n[![License](https://img.shields.io/cocoapods/l/CellProvider.svg?style=flat)](http://cocoapods.org/pods/CellProvider)\n[![Language](https://img.shields.io/badge/language-swift_3.0-ff69b4.svg)](http://cocoadocs.org/docsets/CellProvider)\n[![Platform](https://img.shields.io/cocoapods/p/CellProvider.svg?style=flat)](http://cocoapods.org/pods/CellProvider)\n\n\u003cimg src=\"Cells.png\" width=375 /\u003e\n\n# Generic Cell Providers\n\nSwift is great, but sometimes working with UIKit can be less safe than hanging off the edge of a cliff without a net.\n\nMy cell provider implementation ticks off the following:\n\n* Type-safe cell providers\n* Multiple cell types \n\nI actually wrote this code a long time ago for another library of mine, [Populate](http://github.com/shaps80/Populate).\n\nPopulate also includes a more consistent API for dealing with data in your table/collection views. Including type-safety, NSFetchedResultsController-like bindings via a simple Swift array, value-types support, sectioning, sorting, and more.\n\n## Example\n\n```swift\n// First register your cell\ntableView.register(cellClass: PersonCell.self)\n```\n\n```swift\n// Then dequeue with a type-safe function\noverride func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -\u003e UITableViewCell {\n    let person = people[indexPath.item]\n    \n    if person.role == \"Engineer\" {\n        let cell = tableView.dequeueReusableCell(ofType: PersonCell.self, for: indexPath)\n        cell.textLabel?.text = person.name\n        cell.detailTextLabel?.text = person.role\n        return cell\n    } else {\n        let cell = tableView.dequeueReusableCell(with: \"SubtitleCell\", for: indexPath) as UITableViewCell\n        cell.textLabel?.text = person.name\n        cell.detailTextLabel?.text = person.role\n        return cell\n    }\n}\n```\n\n## Implementation\n\nThe key to implementing multiple type-safe cell handling, is the `ResuableView` and `ReusableViewHosting` protocol extensions. It automatically handles all the registration/dequeueing for you -- and all without stringly typed identifiers.\n\n## Installation\n\nThis repo includes a simple sample project for your convenience, however in order to use the code, you simply need to copy `CellProvider.swift` into your project. \n\nAlternatively you can grab the code from GIST, [ReusableView.swift](https://gist.github.com/shaps80/eaa12e5fcddab90a4c6b2fbf321c96e6)\n\n## Platforms and Versions\n\nThe following platforms and version have been tested:\n\n* iOS 8.0 and greater\n* Swift 3.0\n\n## Author\n\n[@shaps](http://twitter.com/shaps)\n\n## License\n\nAll code is available under the MIT license. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshaps80%2Fcellprovider","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshaps80%2Fcellprovider","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshaps80%2Fcellprovider/lists"}