Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Mijick/GridView
Easy Grids with SwiftUI
https://github.com/Mijick/GridView
grid grid-layout ios-swift swift swift-package swift-package-manager swift-packages swift5 swiftlibrary swiftpackagemanager swiftui swiftui-components swiftui-framework
Last synced: 3 months ago
JSON representation
Easy Grids with SwiftUI
- Host: GitHub
- URL: https://github.com/Mijick/GridView
- Owner: Mijick
- License: mit
- Created: 2023-07-03T09:54:39.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-07-30T19:03:15.000Z (3 months ago)
- Last Synced: 2024-07-30T23:26:15.143Z (3 months ago)
- Topics: grid, grid-layout, ios-swift, swift, swift-package, swift-package-manager, swift-packages, swift5, swiftlibrary, swiftpackagemanager, swiftui, swiftui-components, swiftui-framework
- Language: Swift
- Homepage:
- Size: 19.5 KB
- Stars: 72
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-swiftui-libraries - MijickGridView - Easy Grids with SwiftUI (Grid / Content)
README
Layouts made simple
Lay out your data in the blink of an eye. Keep your code clean
Try demo we prepared
|
Roadmap
|
Propose a new feature
GridView is a free, and open-source library for SwiftUI that makes creating grids easier and much cleaner.
* **Improves code quality.** Create a grid using `GridView` constructor - simply pass your data and we'll deal with the rest. Simple as never!
* **Designed for SwiftUI.** While developing the library, we have used the power of SwiftUI to give you powerful tool to speed up your implementation process.
# Getting Started
### ✋ Requirements| **Platforms** | **Minimum Swift Version** |
|:----------|:----------|
| iOS 14+ | 5.0 |### ⏳ Installation
#### [Swift Package Manager][spm]
Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the Swift compiler.Once you have your Swift package set up, adding GridView as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift`.
```Swift
dependencies: [
.package(url: "https://github.com/Mijick/GridView", branch(“main”))
]
```
# Usage
### 1. Call initialiser
To declare a Grid for your data set, call the constructor:```Swift
struct ContentView: View {
private let data = [SomeData]()var body: some View {
GridView(data, id: \.self) { element in
SomeItem(element: element)
}
}
}
```### 2. Customise Grid
Your GridView can be customised by calling `configBuilder` inside the initialiser:```Swift
struct ContentView: View {
private let data = [SomeData]()var body: some View {
GridView(data, id: \.self, content: SomeItem.init, configBuilder: { $0
.insertionPolicy(.fill)
.columns(4)
.verticalSpacing(12)
})
}
}
```### 3. Declare number of columns
You can change the number of columns of an item by calling .columns of Item:
```Swift
struct ContentView: View { ... }
struct SomeItem: View {
...var body: some View {
...
.columns(2)
}
}
```
# Try our demo
See for yourself how does it work by cloning [project][Demo] we created
# License
GridView is released under the MIT license. See [LICENSE][License] for details.
# Our other open source SwiftUI libraries
[PopupView] - The most powerful popup library that allows you to present any popup
[NavigationView] - Easier and cleaner way of navigating through your app
[CalendarView] - Create your own calendar object in no time
[CameraView] - The most powerful CameraController. Designed for SwiftUI
[Timer] - Modern API for Timer
[MIT]: https://en.wikipedia.org/wiki/MIT_License
[SPM]: https://www.swift.org/package-manager
[Demo]: https://github.com/Mijick/GridView-Demo
[License]: https://github.com/Mijick/GridView/blob/main/LICENSE[PopupView]: https://github.com/Mijick/PopupView
[NavigationView]: https://github.com/Mijick/NavigationView
[CalendarView]: https://github.com/Mijick/CalendarView
[CameraView]: https://github.com/Mijick/CameraView
[Timer]: https://github.com/Mijick/Timer