ForEachStore - mbrandonw/swift-composable-architecture GitHub Wiki
ForEachStore
A structure that computes views on demand from a store on a collection of data.
public struct ForEachStore<EachState, EachAction, Data, ID, Content>: DynamicViewContent where Data: Collection, ID: Hashable, Content: View
Inheritance
DynamicViewContent
Initializers
init(_:id:content:)
Initializes a structure that computes views on demand from a store on an array of data and an indexed action.
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: - store: A store on an array of data and an indexed action.
- id: - id: A key path identifying an element.
- content: - content: A function that can generate content given a store of an element.
init(_:content:)
Initializes a structure that computes views on demand from a store on an array of data and an indexed action.
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: - store: A store on an array of data and an indexed action.
- content: - content: A function that can generate content given a store of an element.
init(_:content:)
Initializes a structure that computes views on demand from a store on a collection of data and an identified action.
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: - store: A store on an identified array of data and an identified action.
- content: - content: A function that can generate content given a store of an element.
Properties
data
let data: Data
content
let content: () -> Content
body
var body: some View