{"id":16853164,"url":"https://github.com/devxoul/reusablekit","last_synced_at":"2025-12-12T06:17:03.914Z","repository":{"id":8764885,"uuid":"59677002","full_name":"devxoul/ReusableKit","owner":"devxoul","description":"Generic reusables for UICollectionView and UITableView","archived":false,"fork":false,"pushed_at":"2023-07-04T13:42:26.000Z","size":47,"stargazers_count":162,"open_issues_count":6,"forks_count":37,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T15:06:52.199Z","etag":null,"topics":["cocoa","generic","reusable","swift"],"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/devxoul.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,"governance":null}},"created_at":"2016-05-25T15:53:42.000Z","updated_at":"2024-12-25T22:18:00.000Z","dependencies_parsed_at":"2023-07-13T14:23:22.994Z","dependency_job_id":null,"html_url":"https://github.com/devxoul/ReusableKit","commit_stats":{"total_commits":63,"total_committers":2,"mean_commits":31.5,"dds":0.06349206349206349,"last_synced_commit":"9a5756ba41f7a864ff0738c21876d52b9e67eec7"},"previous_names":["devxoul/genericreusable"],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devxoul%2FReusableKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devxoul%2FReusableKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devxoul%2FReusableKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devxoul%2FReusableKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devxoul","download_url":"https://codeload.github.com/devxoul/ReusableKit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248055284,"owners_count":21040157,"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":["cocoa","generic","reusable","swift"],"created_at":"2024-10-13T13:50:00.044Z","updated_at":"2025-12-12T06:17:03.853Z","avatar_url":"https://github.com/devxoul.png","language":"Swift","readme":"# ReusableKit\n\n![Swift](https://img.shields.io/badge/Swift-5.0-orange.svg)\n[![CocoaPods](http://img.shields.io/cocoapods/v/ReusableKit.svg)](https://cocoapods.org/pods/ReusableKit)\n[![Build Status](https://travis-ci.org/devxoul/ReusableKit.svg)](https://travis-ci.org/devxoul/ReusableKit)\n[![Codecov](https://img.shields.io/codecov/c/github/devxoul/ReusableKit.svg)](https://codecov.io/gh/devxoul/ReusableKit)\n\nGeneric reusables for Cocoa. Currently supports `UITableView` and `UICollectionView`.\n\n## At a Glance\n\n#### Before 🤢\n\n```swift\ncollectionView.register(UserCell.self, forCellWithReuseIdentifier: \"userCell\")\ncollectionView.dequeueReusableCell(withReuseIdentifier: \"userCell\", for: indexPath) as! UserCell\n```\n\n1. A hard-coded string identifier can cause a human error.\n2. A force downcasting should be avoided.\n\n#### After 😊\n\n```swift\nlet reusableUserCell = ReusableCell\u003cUserCell\u003e()\ncollectionView.register(reusableUserCell)\ncollectionView.dequeue(reusableUserCell) // UserCell\n```\n\n1. A string identifier is generated automatically using UUID and stored in the struct.\n2. A generic can ensure the type of the dequeued cell statically.\n\n## Example Usage\n\nIt is recommended to define reusable types as a static constants in an `enum` or a `struct`.\n\n#### UITableView\n\n```swift\n// 1. define\nenum Reusable {\n  static let headerView = ReusableCell\u003cSectionHeaderView\u003e()\n  static let userCell = ReusableCell\u003cUserCell\u003e()\n}\n\n// 2. register\ntableView.register(Reusable.headerView)\ntableView.register(Reusable.userCell)\n\n// 3. dequeue\ntableView.dequeue(Reusable.headerView, for: indexPath)\ntableView.dequeue(Reusable.userCell, for: indexPath)\n```\n\n#### UICollectionView\n\n```swift\n// 1. define\nenum Reusable {\n  static let headerView = ReusableCell\u003cSectionHeaderView\u003e()\n  static let photoCell = ReusableCell\u003cPhotoCell\u003e()\n}\n\n// 2. register\ncollection.register(Reusable.headerView, kind: .header)\ncollection.register(Reusable.photoCell)\n\n// 3. dequeue\ncollection.dequeue(Reusable.headerView, kind: .header, for: indexPath)\ncollection.dequeue(Reusable.photoCell, for: indexPath)\n```\n\n#### RxSwift Extension\n\nReusableKit supports a RxSwift extension.\n\n```swift\nusers // Observable\u003c[String]\u003e\n  .bind(to: collectionView.rx.items(Reusable.userCell)) { i, user, cell in\n    cell.user = user\n  }\n```\n\n## Contrubiting\n\nPull requests are welcomed 💖\n\nIn order to create Xcode project, run:\n\n```console\n$ swift package generate-xcodeproj\n```\n\n## Installation\n\n- **For iOS 9+ projects** with [CocoaPods](https://cocoapods.org):\n\n    ```ruby\n    pod 'ReusableKit'\n    pod 'ReusableKit/RxSwift'  # with RxSwift extension\n    ```\n\n## License\n\n**ReusableKit** is under MIT license. See the [LICENSE](LICENSE) file for more info.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevxoul%2Freusablekit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevxoul%2Freusablekit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevxoul%2Freusablekit/lists"}