- Lazy and non-lazy loading
- Vertical and horizontal arrangement
- Programmatic scroll
- All SwiftUI animations
- Support scroll view system modifiers such as
scrollTargetLayout
,scrollTargetBehavior
,scrollTransition
and 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)
}
items
can be eitherrows()
orcolumn()
, passing an array ofWaterfallItems.Row
orWaterfallItems.Column
to specify how to arrange rows or columns;alignment
andspacing
allows to customize position and spacing of each view in a column/rowspacing
specify the distance between columns or rowsdata
the collection of items to be showed in the gridid
the keypath to identify which property of each element is the id. ForIdentifiable
elements, 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