{"id":21619063,"url":"https://github.com/bannzai/enumerable","last_synced_at":"2025-07-03T03:04:09.270Z","repository":{"id":56910023,"uuid":"101605459","full_name":"bannzai/Enumerable","owner":"bannzai","description":"Swift Enum can enumerable.","archived":false,"fork":false,"pushed_at":"2018-09-04T15:00:54.000Z","size":27,"stargazers_count":24,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-07-03T03:03:51.236Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/bannzai.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":"2017-08-28T04:59:49.000Z","updated_at":"2021-11-14T12:59:48.000Z","dependencies_parsed_at":"2022-08-21T04:20:28.279Z","dependency_job_id":null,"html_url":"https://github.com/bannzai/Enumerable","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/bannzai/Enumerable","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bannzai%2FEnumerable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bannzai%2FEnumerable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bannzai%2FEnumerable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bannzai%2FEnumerable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bannzai","download_url":"https://codeload.github.com/bannzai/Enumerable/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bannzai%2FEnumerable/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263250595,"owners_count":23437288,"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-11-24T23:07:48.078Z","updated_at":"2025-07-03T03:04:09.212Z","avatar_url":"https://github.com/bannzai.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Enumerable\n\n**Enumrable** can get all the elements of `Enum`.\n\n# Usage\nCurrently only support `Int`.\n\nDefine `YourEnum`.\n```swift\nenum YourEnum: Int, Enumerable {\n  case one\n  case two\n  case three\n  case four\n}\n```\n\nGet all elemnts.\n\n```swift\nprint(YourEnum.elements) // one, two, three, four\nprint(YourEnum.count) // 4\n```\n\nIt is particularly compatible with `TableView` and `CollectionView`.\n\n```swift\nenum RowType: Int, Enumerable {\n  case one\n  case two\n  case three\n  case four\n}\n\npublic func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -\u003e Int {\n  return RowType.count\n}\n\n\npublic func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -\u003e UICollectionViewCell {\n  guard let item = RowType(rawValue: indexPath.item) else {\n    fatalError(\"out of section type: \\(indexPath.section), model has sections: \\(String(describing: model?.sections))\")\n  }\n  switch item {\n    case .one:\n    case two:\n  ...\n  }\n  ...\n}\n\n```\n\n# License\n\nEnumerable is available under the MIT license. See the LICENSE file for more info.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbannzai%2Fenumerable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbannzai%2Fenumerable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbannzai%2Fenumerable/lists"}