A powerful and flexible grid layout system for SwiftUI, inspired by CSS Grid.
Grid is a SwiftUI library that provides a comprehensive grid container for building complex layouts. It fills a significant gap in SwiftUI's native layout capabilities by offering fine-grained control over track sizing, item placement, and flow direction, similar to CSS Grid. The library enables developers to create sophisticated, responsive layouts with declarative syntax while maintaining SwiftUI's idiomatic approach.
SwiftUI developers building iOS, macOS, or tvOS applications who need advanced grid-based layouts beyond SwiftUI's built-in options. This includes developers creating complex UIs like dashboards, calculators, media galleries, or any interface requiring precise control over item positioning and spanning.
Developers choose Grid over alternatives because it brings the power and expressiveness of CSS Grid to SwiftUI, offering features like flexible track sizing (.fr, .pt, .fit), item spanning, explicit positioning, flow control, and packing algorithms. Its declarative syntax and built-in support for animations and caching provide a native SwiftUI experience while solving layout limitations.
The most powerful Grid container missed in SwiftUI
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Supports flexible (.fr), fixed (.pt), and content-based (.fit) track sizing, mirroring CSS Grid for responsive layouts, as demonstrated in the README with mixed track examples.
Enables item spanning across rows/columns and explicit start positions using modifiers like .gridSpan and .gridStart, allowing complex layouts like calculators or dashboards.
Provides .gridAnimation() modifier for animated layout updates and guidance on using Identifiable models or GridGroup for smooth transitions, though requires careful ID management.
Uses @GridBuilder for full if/else and switch statement support within grid bodies, enhancing declarative syntax and dynamic content handling.
Requires iOS 14.0+ or macOS 10.15+ for full features, limiting older system support, and layout caching is iOS-only, as noted in the documentation.
The README warns that ForEach without Identifiable models can cause animation issues, forcing developers to manage IDs meticulously for correct transitions.
Roadmap admits missing CSS Grid features like dual dimension track sizes and grid-auto-rows/columns, which may hinder developers expecting full parity.