init(columns: [GridItem ], alignment: HorizontalAlignment , spacing: CGFloat?, pinnedViews : PinnedScrollableViews , content: () -> Content)
Creates a grid that grows vertically, given the provided properties.
Availability 有効性
Technology
struct LazyVGrid<Content> where Content : View
The grid is “lazy,” in that the grid view does not create items until they are needed.
In the following example, a Scroll
contains a Lazy
consisting of a two-column grid of Text
views, showing Unicode code points from the “Smileys” group and their corresponding emoji:
var columns: [GridItem] =
Array(repeating: .init(.flexible()), count: 2)
ScrollView {
LazyVGrid(columns: columns) {
ForEach((0...79), id: \.self) {
let codepoint = $0 + 0x1f600
let codepointString = String(format: "%02X", codepoint)
Text("\(codepointString)")
let emoji = String(Character(UnicodeScalar(codepoint)!))
Text("\(emoji)")
}
}.font(.largeTitle)
}
init(columns: [GridItem ], alignment: HorizontalAlignment , spacing: CGFloat?, pinnedViews : PinnedScrollableViews , content: () -> Content)
typealias Body
struct LazyHGrid
struct GridItem