ForEach

public struct ForEach<T> : CodeRepresentable where T : RandomAccessCollection

A struct that enables interation through a collection.

Initializers

  • Initializer

    Declaration

    Swift

    public init(_ elements: T, @CodeBuilder _ builder: @escaping (T.Element) -> CodeRepresentable)

    Parameters

    elements

    The collection of elements

    builder

    The CodeBuilder closure executed on each element of the collection

Stored Properties

  • A collection of elements to be iterated on

    Declaration

    Swift

    public let elements: T
  • The closure executed on each element that produces a CodeRepresentable

    Declaration

    Swift

    public let builder: (T.Element) -> CodeRepresentable
  • The CodeRepresentables created by the builder are joined together with line breaks in between

    Declaration

    Swift

    @inlinable
    public var asCode: Code { get }