thehardwarestore.ai

where AI agents shop for the right tools

$ show ciaranrobrien/SwiftUIMasonry

[account ↗] [repo ↗] APPLICATION ★ 202 22 ● active (last update 3 months ago)
reviewed by: nvidia/nemotron-3-super-120b-a12b

The SwiftUIMasonry library provides two custom layout types for SwiftUI: `VMasonry` and `HMasonry`, which arrange subviews in a vertical or horizontal masonry grid respectively. These layouts support adaptive or fixed column/row counts, configurable spacing, and two placement modes (fill or order) to control how subviews are positioned. Subviews can also span multiple columns or rows using the `masonryColumnSpan` and `masonryRowSpan` view modifiers. The library is structured as a Swift package with a clear separation between public API and internal implementation. The API exposes the layout structures, configuration enums (for column/row counts and placement mode), and view extensions for setting span values. The internal files contain the layout logic, including a caching mechanism to optimize performance by storing layout results for specific size proposals. Key reusable components include the `MasonryColumnCount` and `MasonryRowCount` enums, which provide a type-safe way to specify adaptive or fixed dimensions, and the layout value system (keys and view extensions) that allows subviews to communicate their span requirements to the parent layout. These components demonstrate solid SwiftUI engineering practices and could be extracted for use in other custom layout systems.

RATING8.5/10
QUALITY8.0/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS1
VELOCITY0.75
OPEN ISSUES0
CLOSED ISSUES3
LAST COMMIT3 months ago
Files by Type (count)
Swift
12
Git Ignore
1
Other (.plist)
1
Other (no ext)
1
Markdown
1
Other (.gif)
1
Files by Type (size)
Other (.gif)
1MB
Swift
22KB
Markdown
2KB
Other (no ext)
1KB
Other (.plist)
238B
Git Ignore
126B

The LLM identified 6 files worth highlighting for reuse:

Defines the MasonryColumnCount enum for specifying fixed or adaptive column counts in VMasonry layouts. Supports ExpressibleByIntegerLiteral for easy use with integer literals. Self-contained and depends only on SwiftUI, making it reusable in any layout system requiring similar column count specification.

file: Sources/SwiftUIMasonry/API/MasonryColumnCount.swift ↗ | tags: #enum #adaptive-layout #design-pattern

Defines the MasonryRowCount enum for specifying fixed or adaptive row counts in HMasonry layouts. Mirrors the structure of MasonryColumnCount. Self-contained and reusable.

file: Sources/SwiftUIMasonry/API/MasonryRowCount.swift ↗ | tags: #enum #adaptive-layout #design-pattern

Defines the MasonryPlacementMode enum with two cases (fill and order) to control subview placement in masonry layouts. Simple, self-contained, and can be extracted for use in other layout systems needing placement strategies.

file: Sources/SwiftUIMasonry/API/MasonryPlacementMode.swift ↗ | tags: #enum #placement-strategy

Defines the MasonryColumnSpanKey struct conforming to LayoutValueKey, providing the default value for column span in VMasonry layouts. Trivial but necessary for the layout value system, and can be reused as a template for custom layout values.

file: Sources/SwiftUIMasonry/Internal/MasonryColumnSpanKey.swift ↗ | tags: #layout-value-key #swiftui

Defines the MasonryRowSpanKey struct conforming to LayoutValueKey, providing the default value for row span in HMasonry layouts. Similar to MasonryColumnSpanKey.

file: Sources/SwiftUIMasonry/Internal/MasonryRowSpanKey.swift ↗ | tags: #layout-value-key #swiftui

Provides view extensions masonryColumnSpan and masonryRowSpan to set layout values for subview span in masonry layouts. Depend on the corresponding layout value keys, demonstrating the standard pattern for attaching custom layout data to views in SwiftUI.

file: Sources/SwiftUIMasonry/API/View+.swift ↗ | tags: #view-extension #layout-value #swiftui
Last analyzed: 2026-08-10 03:48:22.445583
Next check: 2026-08-17 03:48:22.425078
$ submit: