ForEach

public struct ForEach<Data, ID, Content> : View, CustomMappable where Data : RandomAccessCollection, Content : View

The collection of underlying identified data that SwiftWeb uses to create views dynamically.

  • Declaration

    Swift

    public func html(forHTMLOfSubnodes htmlOfSubnodes: [HTMLNode]) -> HTMLNode
  • Creates an instance that uniquely identifies and creates views across updates based on the provided key path to the underlying data’s identifier.

    Declaration

    Swift

    public init(_ data: Data, id idKeyPath: KeyPath<Data.Element, ID>, content: @escaping (Data.Element) -> Content)
  • Declaration

    Swift

    public func customMap<T>(_ transform: (TypeErasedView) -> T) -> [T]

Available where Data.Element == ID

  • Creates an instance that uniquely identifies and creates views across updates based on the identity of the underlying data.

    Declaration

    Swift

    public init(_ data: Data, content: @escaping (Data.Element) -> Content)