{"id":13467092,"url":"https://github.com/KyoheiG3/GridView","last_synced_at":"2025-03-26T00:32:02.552Z","repository":{"id":22213433,"uuid":"74809726","full_name":"KyoheiG3/GridView","owner":"KyoheiG3","description":"Reusable GridView with excellent performance and customization that can be time table, spreadsheet,  paging and more.","archived":false,"fork":false,"pushed_at":"2023-09-06T13:32:06.000Z","size":184,"stargazers_count":858,"open_issues_count":8,"forks_count":58,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-03-20T21:22:38.970Z","etag":null,"topics":["grid-layout","gridview","ios","spreadsheet","swift","timetable"],"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/KyoheiG3.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-11-26T06:45:43.000Z","updated_at":"2025-01-03T06:13:15.000Z","dependencies_parsed_at":"2022-08-20T03:31:42.658Z","dependency_job_id":"9485276b-c044-4865-bdcc-ddd5d377658f","html_url":"https://github.com/KyoheiG3/GridView","commit_stats":{"total_commits":114,"total_committers":5,"mean_commits":22.8,"dds":"0.14912280701754388","last_synced_commit":"1616db6bc99363e4512bd6ffea5e13d6a8cf0a34"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KyoheiG3%2FGridView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KyoheiG3%2FGridView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KyoheiG3%2FGridView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KyoheiG3%2FGridView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KyoheiG3","download_url":"https://codeload.github.com/KyoheiG3/GridView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245566099,"owners_count":20636391,"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":["grid-layout","gridview","ios","spreadsheet","swift","timetable"],"created_at":"2024-07-31T15:00:53.040Z","updated_at":"2025-03-26T00:31:57.542Z","avatar_url":"https://github.com/KyoheiG3.png","language":"Swift","readme":"# GridView\n\n[![Build Status](https://travis-ci.org/KyoheiG3/GridView.svg?branch=master)](https://travis-ci.org/KyoheiG3/GridView)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![Version](https://img.shields.io/cocoapods/v/G3GridView.svg?style=flat)](http://cocoadocs.org/docsets/G3GridView)\n[![License](https://img.shields.io/cocoapods/l/G3GridView.svg?style=flat)](http://cocoadocs.org/docsets/G3GridView)\n[![Platform](https://img.shields.io/cocoapods/p/G3GridView.svg?style=flat)](http://cocoadocs.org/docsets/G3GridView)\n\nGridView can tile the view while reusing it. It has an API like UIKit that works fast. Even when device rotates it smoothly relayout.\n\n\u003cimg alt=\"timetable\" src=\"https://github.com/KyoheiG3/assets/blob/master/GridView/timetable_p.png\" height=\"333\"\u003e \u003cimg alt=\"timetable\" src=\"https://github.com/KyoheiG3/assets/blob/master/GridView/timetable_l.png\" width=\"333\"\u003e\n\n#### [Appetize's Demo](https://appetize.io/app/d5qk2927a8y07armrbbdck64c4)\n\n### You Can\n\n- Scroll like paging\n- Scroll infinitely\n- Scale the view\n- Call API like the `UITableView`\n\n## Requirements\n\n- Swift 5.0\n- iOS 9.0 or later\n\n## How to Install\n\n#### CocoaPods\n\nAdd the following to your `Podfile`:\n\n```Ruby\npod \"G3GridView\"\n```\n\n\u003e :warning: **WARNING :** If you want to install from `CocoaPods`, must add `G3GridView` to Podfile because there is a `GridView` different from this `GridView`.\n\n#### Carthage\n\nAdd the following to your `Cartfile`:\n\n```Ruby\ngithub \"KyoheiG3/GridView\"\n```\n\n## Over View\n\nGridView can scroll in any direction while reusing Cell like `UITableView`. Also it is based `UIScrollView` and paging and scaling are possible. If necessary, it is possible to repeat the left and right scroll infinitely.\n\nGridView is one `UIScrollView`, but the range which Cell is viewed depends on Superview. Cell reuse is also done within the range which Superview is viewed, so its size is very important.\n\nOn the other hand, scaling and paging depend to position and size of GridView. 'bounds' is important for paging, 'frame' is important in scaling. The same is true for  offset of content.\n\nThe following image is a visual explanation of the view hierarchy.\n\n![Hierarchy](https://github.com/KyoheiG3/assets/blob/master/GridView/hierarchy.png)\n\nYou can use it like the `UITableView` APIs. However, there is concept of `Column`. The following functions are delegate APIs of 'GridView'.\n\n```swift\nfunc gridView(_ gridView: GridView, numberOfRowsInColumn column: Int) -\u003e Int\nfunc gridView(_ gridView: GridView, cellForRowAt indexPath: IndexPath) -\u003e GridViewCell\n\n@objc optional func numberOfColumns(in gridView: GridView) -\u003e Int\n```\n\nYou can see that must return the count.\n\n## Examples\n\nThis project is including two examples that is timetable and paging. Those can change on Interface Builder for following:\n\n![Example](https://github.com/KyoheiG3/assets/blob/master/GridView/example.gif)\n\nTry the two examples.\n\n| timetable | paging |\n|-|-|\n|\u003cimg alt=\"timetable\" src=\"https://github.com/KyoheiG3/assets/blob/master/GridView/timetable.gif\" width=\"333\"\u003e|\u003cimg alt=\"paging\" src=\"https://github.com/KyoheiG3/assets/blob/master/GridView/paging.gif\" width=\"333\"\u003e|\n\n\n## Usage\n\n### Variables\n\n#### Infinite Loop\n\nA horizontal loop is possible.\n\n```swift\nopen var isInfinitable: Bool\n```\n\n- Default is `true`.\n- Set `false` if you don't need to loop of view.\n\n\u003cimg alt=\"loop\" src=\"https://github.com/KyoheiG3/assets/blob/master/GridView/loop.gif\" height=\"333\"\u003e\n\n```swift\ngridView.isInfinitable = true\n```\n\n#### Scaling\n\nContent is done relayout rather than scaling like 'UIScrollView'.\n\n```swift\nopen var minimumScale: Scale\nopen var maximumScale: Scale\n```\n\n- Default for x and y are 1.\n- Set the vertical and horizontal scales.\n\n```swift\npublic var currentScale: Scale { get }\n```\n\n- Get current vertical and horizontal scales.\n\n\u003cimg alt=\"scaling\" src=\"https://github.com/KyoheiG3/assets/blob/master/GridView/scaling.gif\" height=\"333\"\u003e\n\n```swift\ngridView.minimumScale = Scale(x: 0.5, y: 0.5)\ngridView.maximumScale = Scale(x: 1.5, y: 1.5)\n```\n\n#### Fill for Cell\n\nIt is possible to decide the placement of Cell at relayout.\n\n```swift\nopen var layoutWithoutFillForCell: Bool\n```\n\n- Default is `false`.\n- Set `true` if need to improved view layout performance.\n\n| false | true |\n|-|-|\n|\u003cimg alt=\"false\" src=\"https://github.com/KyoheiG3/assets/blob/master/GridView/false.gif\" width=\"333\"\u003e|\u003cimg alt=\"true\" src=\"https://github.com/KyoheiG3/assets/blob/master/GridView/true.gif\" width=\"333\"\u003e|\n\n```swift\ngridView.layoutWithoutFillForCell = true\n```\n\n#### Content Offset\n\nIf `isInfinitable` is true, `contentOffset` depends on the content size including size to loop. It is possible to take content offset that actually visible.\n\n```swift\nopen var actualContentOffset: CGPoint { get }\n```\n\n#### Delegate\n\nSet the delegate destination. This delegate property is `UIScrollViewDelegate` but, actually set the `GridViewDelegate`.\n\n```\nweak open var dataSource: GridViewDataSource?\nopen var delegate: UIScrollViewDelegate?\n```\n\n### Functions\n\n#### State\n\nGet the view state.\n\n```swift\npublic func visibleCells\u003cT\u003e() -\u003e [T]\npublic func cellForRow(at indexPath: IndexPath) -\u003e GridViewCell?\npublic func rectForRow(at indexPath: IndexPath) -\u003e CGRect\npublic func indexPathsForSelectedRows() -\u003e [IndexPath]\npublic func indexPathForRow(at position: CGPoint) -\u003e IndexPath\n```\n\n#### Operation\n\nOperate the view.\n\n```swift\npublic func contentScale(_ scale: CGFloat)\npublic func reloadData()\npublic func invalidateContentSize()\npublic func invalidateLayout(horizontally: Bool = default)\npublic func deselectRow(at indexPath: IndexPath)\noverride open func setContentOffset(_ contentOffset: CGPoint, animated: Bool)\npublic func scrollToRow(at indexPath: IndexPath, at scrollPosition: GridViewScrollPosition = default, animated: Bool = default)\n```\n\n## LICENSE\n\nUnder the MIT license. See [LICENSE](./LICENSE) file for details.\n","funding_links":[],"categories":["Libs","Swift","UI [🔝](#readme)"],"sub_categories":["UI"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKyoheiG3%2FGridView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FKyoheiG3%2FGridView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKyoheiG3%2FGridView/lists"}