ForEachStore

public struct ForEachStore<EachState, EachAction, Data, ID, Content>: DynamicViewContent
where Data: Collection, ID: Hashable, Content: View

A structure that computes views on demand from a store on a collection of data.

  • Declaration

    Swift

    public let data: Data
  • Initializes a structure that computes views on demand from a store on an array of data and an indexed action.

    Declaration

    Swift

    public init<EachContent>(
      _ store: Store<Data, (Data.Index, EachAction)>,
      id: KeyPath<EachState, ID>,
      content: @escaping (Store<EachState, EachAction>) -> EachContent
    )
    where
      Data == [EachState],
      EachContent: View,
      Content == WithViewStore<
        Data, (Data.Index, EachAction),
        ForEach<ContiguousArray<(Data.Index, EachState)>, ID, EachContent>
      >

    Parameters

    store

    A store on an array of data and an indexed action.

    id

    A key path identifying an element.

    content

    A function that can generate content given a store of an element.

  • Initializes a structure that computes views on demand from a store on an array of data and an indexed action.

    Declaration

    Swift

    public init<EachContent>(
      _ store: Store<Data, (Data.Index, EachAction)>,
      content: @escaping (Store<EachState, EachAction>) -> EachContent
    )
    where
      Data == [EachState],
      EachContent: View,
      Content == WithViewStore<
        Data, (Data.Index, EachAction),
        ForEach<ContiguousArray<(Data.Index, EachState)>, ID, EachContent>
      >,
      EachState: Identifiable,
      EachState.ID == ID

    Parameters

    store

    A store on an array of data and an indexed action.

    content

    A function that can generate content given a store of an element.

  • Initializes a structure that computes views on demand from a store on a collection of data and an identified action.

    Declaration

    Swift

    public init<EachContent: View>(
      _ store: Store<IdentifiedArray<ID, EachState>, (ID, EachAction)>,
      content: @escaping (Store<EachState, EachAction>) -> EachContent
    )
    where
      EachContent: View,
      Data == IdentifiedArray<ID, EachState>,
      Content == WithViewStore<
        IdentifiedArray<ID, EachState>, (ID, EachAction),
        ForEach<IdentifiedArray<ID, EachState>, ID, EachContent>
      >

    Parameters

    store

    A store on an identified array of data and an identified action.

    content

    A function that can generate content given a store of an element.

  • Declaration

    Swift

    public var body: some View { get }