-
Declaration
Swift
public var viewStore: ViewValues -
Declaration
Swift
public var body: View { get } -
Creates views based on uniquely identifiable data, by using a custom id.
The
idvalue of each data should be unique.Declaration
Swift
public init(_ data: Data, id: KeyPath<Data.Element, ID>, content: @escaping (Data.Element) -> Content)Parameters
dataThe identified data that the
ForEachinstance uses to create views dynamically.idA keypath for the value that uniquely identify each data.
contentThe view builder that creates views dynamically.
-
Creates views based on uniquely identifiable data.
The
idvalue of each data should be unique.Declaration
Swift
public init(_ data: Data, content: @escaping (Data.Element) -> Content)Parameters
dataThe identified data that the
ForEachinstance uses to create views dynamically.contentThe view builder that creates views dynamically.
-
Creates an instance that computes views on demand over a constant range.
To compute views on demand over a dynamic range use
ForEach(_:id:content:).Declaration
Swift
public init(_ data: Range<Int>, content: @escaping (Int) -> Content)
View on GitHub
ForEach Structure Reference