GithubHelp home page GithubHelp logo

mijick / gridview Goto Github PK

View Code? Open in Web Editor NEW
46.0 1.0 0.0 13 KB

Easy Grids with SwiftUI

License: MIT License

Swift 100.00%
grid grid-layout ios-swift swift swift-package swift-package-manager swift-packages swift5 swiftlibrary swiftpackagemanager

gridview's Introduction


GridView Logo

Layouts made simple

Lay out your data in the blink of an eye. Keep your code clean

Try demo we prepared


Library in beta version Designed for SwiftUI Platforms: iOS Current Version License: MIT

Made in Kraków Follow us on X Let's work together Stargazers

GridView Examples


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 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”))
]

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)
    }
}

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.



Our other open source SwiftUI libraries

PopupView - The most powerful popup library that allows you to present any popup
Navigattie - Easier and cleaner way of navigating through your app
Timer - Modern API for Timer

gridview's People

Contributors

fulcrumone avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

gridview's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.