- Lazy and non-lazy loading
- Vertical and horizontal arrangement
- Programmatic scroll
- All SwiftUI animations
- Support scroll view system modifiers such as
scrollTargetLayout,scrollTargetBehavior,scrollTransitionand so on - Section header and footer
| Items roerder | Custom scroll paging and transitions |
|---|---|
![]() |
![]() |
WaterfallGrids can be installed using Swift Package Manager.
-
In Xcode open File/Swift Packages/Add Package Dependency... menu.
-
Copy and paste the package URL:
https://github.com/ricocrescenzio95/WaterfallGrids
For more details refer to Adding Package Dependencies to Your App documentation.
In general WaterfallGrid or LazyWaterfallGrid APIs are very similar to other SwiftUI views like LazyVGrid and ForEach; both views have same initializers, allowing to easily switch between eager and lazy version.
WaterfallGrid(
items: .columns([.init(), .init(alignment: .trailing, spacing: 10)]),
spacing: 20,
data: [0, 1, 2, 3, 4, 5, 6, 8, 9, 10],
id: \.self
) { item in
ItemView(item: item)
}itemscan be eitherrows()orcolumn(), passing an array ofWaterfallItems.RoworWaterfallItems.Columnto specify how to arrange rows or columns;alignmentandspacingallows to customize position and spacing of each view in a column/rowspacingspecify the distance between columns or rowsdatathe collection of items to be showed in the grididthe keypath to identify which property of each element is the id. ForIdentifiableelements, this is inferred.- content: a closure that returns a view for each element of
data.
For advanced usages, please refer to the full Documentation.
Use Apple DocC generated documentation, from Xcode, Product > Build Documentation.
If you found a bug, you can open an issue as a bug here
Want a new feature? Open an issue here
You can also open your own PR and contribute to the project! Contributing 🤝
This software is provided under the MIT license


