Published on

ForEach in SwiftUI

Authors
  • Name
    Twitter

A structure that computes views on demand from an underlying collections of identified data

一个结构,可以按需从底层已标识的数据集合中动态生成视图。

Use ForEach to provide views based on a RandomAccessCollection of some data type. Either the collection’s elements must conform to Identifiable or you need to provide an id parameter to the ForEach initializer.

RandomAccessCollection

作用:高效地通过索引访问每一个元素