ForEach

    An element that lazily renders HTML for each element in a sequence.

    ForEach.swift:11
    struct ForEach<Data, Content> where Data : Sequence, Content : HTML

    Using ForEach instead of for ... in is potentially more efficient when rendering a large number of elements, as the result does not need to be collected into an array before rendering.

    ForEach(1 ... 100) { index in
       li { "Item \(index)" }
    }

    Citizens in Elementary

    Conformances

    Type members

    Show system interfaces (2)

    Hide system interfaces

    Type features

    Show implementation details (2)

    Hide implementation details

    Instance features

    Show obsolete interfaces (1)

    Hide obsolete interfaces

    Show system interfaces (1)

    Hide system interfaces

    Citizens in Elementary

    where Content:HTML, Data:Sequence, Data:Sendable

    Conformances

    • protocol Sendable

      A type whose values can safely be passed across concurrency domains by copying.