๐Ÿ–ผ๏ธForEach

โ•ฑ๐Ÿšง under construction -> View Groupings

SwiftUI โŸฉ view โŸฉ groupings โŸฉ ForEach

ForEach generates views for each element in a collection.

ForEach requires that each element provide an id,

  • either explicitly in the ForEach initializer,

  • or by conforming to the Identifiable protocol.

// <collection> must conform to Identifiable
ForEach(collection) { element in
    Text(element.name)
}

โญ๏ธ ๆณจๆ„๏ผš

  • ForEach doesnโ€™t get hit by the 10-view limit. โญ๏ธ

  • ForEach ไธไธ€ๅฎšๆ˜ฏ View๏ผŒไนŸๅฏ่ƒฝๆ˜ฏๅ…ถไป–ๆฑ่ฅฟ๏ผŒๅฆ‚๏ผšTableRowContent

(๐Ÿ‘‰ See: ๐Ÿ“œ ๅ”ๅฎš)

Last updated