scrollTargetLayout、scrollTargetBehavior、scrollTransition 等| Item 重新排序 | 自定义滚动分页和过渡效果 |
|---|---|
![]() |
![]() |
可以使用 Swift Package Manager 安装 WaterfallGrids。
在 Xcode 中打开 File/Swift Packages/Add Package Dependency... 菜单。
复制并粘贴包 URL
https://github.com/ricocrescenzio95/WaterfallGrids
更多详情请参考 Adding Package Dependencies to Your App 文档。
通常,WaterfallGrid 或 LazyWaterfallGrid API 与其他 SwiftUI 视图(如 LazyVGrid 和 ForEach)非常相似;这两个视图具有相同的初始化器,可以轻松地在 eager 和 lazy 版本之间切换。
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 可以是 rows() 或 column(),传递 WaterfallItems.Row 或 WaterfallItems.Column 数组来指定如何排列行或列;alignment 和 spacing 允许自定义列/行中每个视图的位置和间距spacing 指定列或行之间的距离data 要在网格中显示的 item 集合id 用于标识每个元素 id 属性的 keypath。对于 Identifiable 元素,这是自动推断的。data 的每个元素返回一个视图。有关高级用法,请参考完整文档。
使用 Apple DocC 生成的文档,从 Xcode 中,选择 Product > Build Documentation。
如果您发现 Bug,可以在 这里 提交 Bug issue
想要新功能?在 这里 提交 issue
本软件根据 MIT 许可证提供