# QGrid **Repository Path**: jerry8679/QGrid ## Basic Information - **Project Name**: QGrid - **Description**: ่กจๅ“ฅ - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-02-19 - **Last Updated**: 2022-02-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README **[NOTE]** If you'd like to see `QGrid` in action, check out this demo of `QDesigner` (see video below). Install `QDesigner`: [https://apps.apple.com/us/app/qdesigner/id1500810470](https://apps.apple.com/us/app/qdesigner/id1500810470) Install a companion `QDesigner Client` on iPhone, to see your UI design on a target device, updated in real-time: [https://apps.apple.com/us/app/qdesignerclient/id1500946484](https://apps.apple.com/us/app/qdesignerclient/id1500946484) Learn more at: [https://Q-Mobile.IT/Q-Designer](https://Q-Mobile.IT/Q-Designer) [![QDesigner Preview](QDesignerPreview.png)](https://youtu.be/_nCM9O-v7mQ) ![QGrid: The missing SwiftUI collection view.](QGridLogo.png)

โ€œBuild Platforms Swift Package Manager License: MIT Twitter: @karolkulesza

`QGrid` is the missing SwiftUI collection view. It uses the same approach as SwiftUI's `List` view, by computing its cells from an underlying collection of identified data.
## ๐Ÿ”ท Requirements      โœ… macOS 10.15+      โœ… Xcode 11.0      โœ… Swift 5+      โœ… iOS 13+      โœ… tvOS 13+ ## ๐Ÿ”ท Installation `QGrid` is available via [Swift Package Manager](https://swift.org/package-manager). Using Xcode 11, go to `File -> Swift Packages -> Add Package Dependency` and enter [https://github.com/Q-Mobile/QGrid](https://github.com/Q-Mobile/QGrid) ## ๐Ÿ”ท Usage #### โœด๏ธ Basic scenario: In its simplest form, `QGrid` can be used with just this 1 line of code within the `body` of your View, assuming you already have a custom cell view: ```Swift struct PeopleView: View { var body: some View { QGrid(Storage.people, columns: 3) { GridCell(person: $0) } } } struct GridCell: View { var person: Person var body: some View { VStack() { Image(person.imageName) .resizable() .scaledToFit() .clipShape(Circle()) .shadow(color: .primary, radius: 5) .padding([.horizontal, .top], 7) Text(person.firstName).lineLimit(1) Text(person.lastName).lineLimit(1) } } } ``` #### โœด๏ธ Customize the default layout configuration: You can customize how `QGrid` will layout your cells by providing some additional initializer parameters, which have default values: ```swift struct PeopleView: View { var body: some View { QGrid(Storage.people, columns: 3, columnsInLandscape: 4, vSpacing: 50, hSpacing: 20, vPadding: 100, hPadding: 20) { person in GridCell(person: person) } } } ``` ## ๐Ÿ”ท Example App ๐Ÿ“ฑ`QGridTestApp` directory in this repository contains a very simple application that uses `QGrid`. Open `QGridTestApp/QGridTestApp.xcodeproj` and either use the new Xcode Previews feature or just run the app.
## ๐Ÿ”ท QGrid Designer ๐Ÿ“ฑ`QGridTestApp` contains also the QGrid Designer area view, with sliders for dynamic run-time configuration of the QGrid view (with config option to hide it). Please refer to the following demo executed on the device:

## ๐Ÿ”ท Roadmap / TODOs Version `0.1.1` of `QGrid ` contains a very limited set of features. It could be extended by implementing the following tasks:      โ˜˜๏ธ Parameterize spacing&padding configuration depending on the device orientation      โ˜˜๏ธ Add the option to specify scroll direction      โ˜˜๏ธ Add content-only initializer to QGrid struct, without a collection of identified data as argument (As in SwiftUIโ€™s `List`)      โ˜˜๏ธ Add support for other platforms (watchOS)      โ˜˜๏ธ Add `Stack` layout option (as in `UICollectionView`)      โ˜˜๏ธ Add unit/UI tests      โ˜˜๏ธ ... many other improvements ## ๐Ÿ”ท Contributing ๐Ÿ‘จ๐Ÿปโ€๐Ÿ”ง Feel free to contribute to `QGrid ` by creating a pull request, following these guidelines: 1. Fork `QGrid ` 2. Create your feature branch 3. Commit your changes, along with unit tests 4. Push to the branch 5. Create pull request ## ๐Ÿ”ท Author      ๐Ÿ‘จโ€๐Ÿ’ป [Karol Kulesza](https://github.com/karolkulesza) ([@karolkulesza](https://twitter.com/karolkulesza)) ## ๐Ÿ”ท License      ๐Ÿ“„ QGrid is available under the MIT license. See the LICENSE file for more info.