Structure

LazyVGrid

A container view that arranges its child views in a grid that grows vertically, creating items only as needed.

Declaration 宣言

struct LazyVGrid<Content> where Content : View

Overview 概要

The grid is “lazy,” in that the grid view does not create items until they are needed.

In the following example, a ScrollView contains a LazyVGrid 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)
 }

Topics 話題

Creating a Vertical Grid

Supporting Types 支援を行う型

Default Implementations 省略時実装

Relationships 関係

Conforms To 次に準拠

See Also 参照

Grids