๐Ÿ“ฆForEach

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

SwiftUI โŸฉ View Groupings โŸฉ ForEach

ForEach generates views for each element in a collection.

โญ ่ชžๆณ•็ฏ„ไพ‹๏ผš

// <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