A Swift package that lets macOS apps add user-customizable global keyboard shortcuts with a ready-made recorder UI.
exyte/Grid
A SwiftUI grid container inspired by CSS Grid, supporting flexible, fixed and content-sized tracks, spanning, and explicit placement.
- Stars
- 2,124
- Forks
- 101
- Open issues
- 4
- Last commit
- 14 hours ago
What is it?
Grid is a Swift library that provides a grid layout container for SwiftUI, modeled on CSS Grid. It lets developers arrange views in rows or columns with track sizes defined in fixed points, flexible fractional units, or content-based sizing. SwiftUI's built-in stacks and lazy grids don't offer this combination of track sizing, spanning, and placement control out of the box.
Items can span multiple tracks, be placed at explicit row or column positions, and be packed using sparse or dense placement. The container supports row-flow or column-flow growth, scrollable or fill content modes, per-item and whole-grid alignment, spacing options, and animated updates. Views can also be grouped with GridGroup, and conditional statements are supported through a custom result builder.
The library is installable through Swift Package Manager or CocoaPods and targets iOS 14 and later, macOS 10.15 and later, and tvOS. It is MIT licensed.
Key features
- 01Track sizes defined as fixed points, flexible fr units, or content-based fit
- 02Views can span multiple rows or columns with gridSpan
- 03Explicit row and column placement with gridStart
- 04Row or column flow with sparse or dense packing
- 05Scrollable and fill content modes
- 06Per-item and whole-grid alignment, plus animated content updates
Use cases
- Building dashboard or card layouts in SwiftUI with mixed fixed and flexible columns
- Creating calculator-style button grids or photo galleries with spanning items
- Porting CSS Grid layout concepts to native iOS or macOS apps
Quick start
- 1
Add the package via Swift Package Manager using the repository URL https://github.com/exyte/Grid in Xcode
- 2
Or add the pod to your Podfile for CocoaPods
pod 'ExyteGrid' - 3
Use Grid(tracks: 3) with views inside its closure to lay them out
Things to know
- Requires iOS 14.0+ or macOS 10.15+ and Xcode 12+, so it is Apple-platform only.
- Views inside a plain ViewBuilder are limited to 10, so larger grids need GridGroup.
In collections
Topics
FAQ
- What is Grid?
- A SwiftUI grid container inspired by CSS Grid, supporting flexible, fixed and content-sized tracks, spanning, and explicit placement. Grid is a Swift library that provides a grid layout container for SwiftUI, modeled on CSS Grid. It lets developers arrange views in rows or columns with track sizes defined in fixed points, flexible fractional units, or content-based sizing. SwiftUI's built-in stacks and lazy grids don't offer this combination of track sizing, spanning, and placement control out of the box.
- Is Grid free to use? What license does it have?
- Grid is open source under the MIT license. Check the license terms before using it in commercial products.
- Is Grid still maintained?
- Actively maintained. The last commit to Grid was on Nov 6, 2026.
- What can I use Grid for?
- Building dashboard or card layouts in SwiftUI with mixed fixed and flexible columns Creating calculator-style button grids or photo galleries with spanning items Porting CSS Grid layout concepts to native iOS or macOS apps
- How do I install Grid?
- Add the package via Swift Package Manager using the repository URL https://github.com/exyte/Grid in Xcode Or add the pod to your Podfile for CocoaPods: pod 'ExyteGrid' Use Grid(tracks: 3) with views inside its closure to lay them out
- Where can I get Grid?
- The source code and installation instructions are on GitHub: https://github.com/exyte/Grid
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A Go library for generating PDF documents using a Bootstrap-inspired grid of rows and columns, built on gofpdf.
A Swift package that fills gaps in SwiftUI with extra views, extensions and wrappers for UIKit and AppKit functionality.
A lightweight pure-Swift library for downloading, caching and displaying images from the web in iOS, macOS and SwiftUI apps.
An open-source SwiftUI client for the Mastodon decentralized social network, available on iOS, macOS, iPadOS and visionOS.
A Swift library that lets SwiftUI code access the underlying UIKit or AppKit view behind a SwiftUI view to customize it.