Contents

liyanan2004/adaptivegrid

An alternative Grid View for old platforms.

Platforms

  • iOS 14.0+
  • macOS 11.0+
  • tvOS 14.0+
  • watchOS 7.0+

Getting Started

It’s similar to SwiftUI’s native Grid, so you can quickly gettting started.

AdaptiveGrid {
    GridRowContainer {
        GridCellContainer {
            Text("Hello")
        }
        GridCellContainer {
            Image(systemName: "globe")
        }
    }
    
    GridRowContainer {
        GridCellContainer {
            Image(systemName: "hand.wave")
        }
        GridCellContainer {
            Text("World")
        }
    }
}

You can specify both horizontal and vertical spacing just like how you use the SwiftUI’s native Grid view.

AdaptiveGrid(horizontalSpacing: 10, verticalSpacing: 10) {
    ...
}

If you want to add dividers as row seperators, specify showDivider to true.

AdaptiveGrid(showDivider: true) {
    ...
}

Note

Currently, Adaptive Grid takes the maximum space horizontally, which is the same with SwiftUI’s built-in Grid with Dividers added, so you may need to specify a width or maxWidth manually to control the size.

Package Metadata

Repository: liyanan2004/adaptivegrid

Default branch: main

README: README.md