{"id":13338678,"url":"https://github.com/LePips/CollectionView","last_synced_at":"2025-03-11T10:31:45.585Z","repository":{"id":57916133,"uuid":"528532249","full_name":"LePips/CollectionView","owner":"LePips","description":"Basic SwiftUI CollectionView","archived":true,"fork":false,"pushed_at":"2022-09-26T01:05:07.000Z","size":28,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-10T18:12:41.792Z","etag":null,"topics":["ios","swift","swiftui","tvos"],"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/LePips.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":"2022-08-24T17:45:16.000Z","updated_at":"2025-02-21T18:58:20.000Z","dependencies_parsed_at":"2023-01-18T19:46:43.579Z","dependency_job_id":null,"html_url":"https://github.com/LePips/CollectionView","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/LePips%2FCollectionView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LePips%2FCollectionView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LePips%2FCollectionView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LePips%2FCollectionView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LePips","download_url":"https://codeload.github.com/LePips/CollectionView/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243015430,"owners_count":20222080,"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":["ios","swift","swiftui","tvos"],"created_at":"2024-07-29T19:17:08.424Z","updated_at":"2025-03-11T10:31:43.843Z","avatar_url":"https://github.com/LePips.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CollectionView\n\nA basic wrapper of `UICollectionView` to overcome `LazyVGrid/LazyHGrid` performance issues.\n\nInfluenced by [SwiftUICollection](https://github.com/defagos/SwiftUICollection) and [ASCollectionView](https://github.com/apptekstudios/ASCollectionView).\n\n# Usage\n\nCurrently, `CollectionView` just acts to display items for performance improvements. Further enhancements may be implemented in the future.\n\n\u003cdetails\u003e\n\u003csummary\u003eiOS Example\u003c/summary\u003e\n\n```swift\nstruct ContentView: View {\n    \n    @State\n    var items = (0..\u003c100).map { \"\\($0)\" }\n    \n    static let colors: [Color] = [.blue, .red, .green, .yellow, .purple, .cyan, .indigo, .mint, .orange]\n    \n    var body: some View {\n        CollectionView(items: items) { indexPath, item, proxy in\n            Button {\n                if indexPath.row \u003c 50 {\n                    proxy.scrollTo(.bottom)\n                } else {\n                    proxy.scrollTo(.top)\n                }\n            } label: {\n                ZStack {\n                    Self.colors.randomElement()\n                        .frame(height: 150)\n                        .cornerRadius(10)\n                    \n                    Text(item)\n                }\n            }\n        }\n        .willReachEdge(insets: .init(top: 300, leading: 0, bottom: 300, trailing: 0)) { edge in\n            print(\"Will reach edge: \\(edge)\")\n        }\n        .onEdgeReached { edge in\n            print(\"Edge reached: \\(edge)\")\n        }\n        .layout { _, layoutEnvironment in\n                .grid(layoutEnvironment: layoutEnvironment,\n                      layoutMode: .adaptive(withMinItemSize: 100),\n                      sectionInsets: .zero)\n        }\n        .configure { configuration in\n            configuration.showsVerticalScrollIndicator = false\n        }\n        .ignoresSafeArea()\n    }\n}\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003etvOS Example\u003c/summary\u003e\n\n```swift\nstruct ContentView: View {\n    \n    @State\n    var items = (0..\u003c15).map { \"\\($0)\" }\n    \n    static let colors: [Color] = [.blue, .red, .green, .yellow, .purple, .cyan, .indigo, .mint, .orange]\n    \n    var body: some View {\n        CollectionView(items: items) { _, item, _ in\n            Button {\n                items.append(\"\\(items.count)\")\n            } label: {\n                ZStack {\n                    Self.colors.randomElement()\n                        .frame(width: 200, height: 200)\n                    \n                    Text(item)\n                }\n            }\n            .buttonStyle(CardButtonStyle())\n        }\n        .willReachEdge(insets: .init(top: 300, leading: 0, bottom: 300, trailing: 0)) { edge in\n            print(\"Will reach edge: \\(edge)\")\n        }\n        .onEdgeReached { edge in\n            print(\"Edge reached: \\(edge)\")\n        }\n        .layout { _, layoutEnvironment in\n                .grid(layoutEnvironment: layoutEnvironment,\n                      layoutMode: .adaptive(withMinItemSize: 200),\n                      itemSpacing: 60,\n                      lineSpacing: 40,\n                      itemSize: .estimated(200))\n        }\n        .configure { configuration in\n            configuration.showsVerticalScrollIndicator = false\n        }\n        .ignoresSafeArea()\n    }\n}\n```\n\u003c/details\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLePips%2FCollectionView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FLePips%2FCollectionView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLePips%2FCollectionView/lists"}