Home

Awesome

<br> <p align="center"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://github.com/Mijick/Assets/blob/main/GridView/Logotype/On%20Dark.svg"> <source media="(prefers-color-scheme: light)" srcset="https://github.com/Mijick/Assets/blob/main/GridView/Logotype/On%20Light.svg"> <img alt="GridView Logo" src="https://github.com/Mijick/Assets/blob/main/GridView/Logotype/On%20Dark.svg" width="76%""> </picture> </p> <h3 style="font-size: 5em" align="center"> Layouts made simple </h3> <p align="center"> Lay out your data in the blink of an eye. Keep your code clean </p> <p align="center"> <a href="https://github.com/Mijick/GridView-Demo" rel="nofollow">Try demo we prepared</a> | <a href="https://mijick.notion.site/fb09f0a2efdd4086b81ddbd5b4c1bc55?v=ca8b73e845ab430cb6a17e0faf925172" rel="nofollow">Roadmap</a> | <a href="https://github.com/Mijick/GridView/issues/new" rel="nofollow">Propose a new feature</a> </p> <br> <p align="center"> <img alt="Library in beta version" src="https://github.com/Mijick/Assets/blob/main/GridView/Labels/Beta.svg"/> <img alt="Designed for SwiftUI" src="https://github.com/Mijick/Assets/blob/main/GridView/Labels/Language.svg"/> <img alt="Platforms: iOS" src="https://github.com/Mijick/Assets/blob/main/GridView/Labels/Platforms.svg"/> <img alt="Current Version" src="https://github.com/Mijick/Assets/blob/main/GridView/Labels/Version.svg"/> <img alt="License: MIT" src="https://github.com/Mijick/Assets/blob/main/GridView/Labels/License.svg"/> </p> <p align="center"> <img alt="Made in Kraków" src="https://github.com/Mijick/Assets/blob/main/GridView/Labels/Origin.svg"/> <a href="https://twitter.com/MijickTeam"> <img alt="Follow us on X" src="https://github.com/Mijick/Assets/blob/main/GridView/Labels/X.svg"/> </a> <a href=mailto:team@mijick.com?subject=Hello> <img alt="Let's work together" src="https://github.com/Mijick/Assets/blob/main/GridView/Labels/Work%20with%20us.svg"/> </a> <a href="https://github.com/Mijick/GridView/stargazers"> <img alt="Stargazers" src="https://github.com/Mijick/Assets/blob/main/GridView/Labels/Stars.svg"/> </a> </p> <p align="center"> <img alt="GridView Examples" src="https://github.com/Mijick/Assets/blob/main/GridView/GIFs/GridView.gif"/> </p> <br>

GridView is a free, and open-source library for SwiftUI that makes creating grids easier and much cleaner.

<br>

Getting Started

✋ Requirements

PlatformsMinimum Swift Version
iOS 14+5.0

⏳ Installation

Swift Package Manager

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.

dependencies: [
    .package(url: "https://github.com/Mijick/GridView", branch(“main”))
]
<br>

Usage

1. Call initialiser

To declare a Grid for your data set, call the constructor:

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:

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:

struct ContentView: View { ... }
struct SomeItem: View {
    ...

    var body: some View {
        ...
            .columns(2)
    }
}
<br>

Try our demo

See for yourself how does it work by cloning project we created

License

GridView is released under the MIT license. See LICENSE for details.

<br><br>

Our other open source SwiftUI libraries

PopupView - The most powerful popup library that allows you to present any popup <br> NavigationView - Easier and cleaner way of navigating through your app <br> CalendarView - Create your own calendar object in no time <br> CameraView - The most powerful CameraController. Designed for SwiftUI <br> Timer - Modern API for Timer