-
Notifications
You must be signed in to change notification settings - Fork 0
Reducer
Enhances a reducer with list actions.
public func list<A>(
state: WritableKeyPath<State, A>,
action: CasePath<Action, ListAction>
) -> Reducer where A: MutableCollection, A: RangeReplaceableCollection
- state: The list state.
- action: The list actions.
Enhances a reducer with list actions for an optional list.
public func list<A>(
state: WritableKeyPath<State, A?>,
action: CasePath<Action, ListAction>
) -> Reducer where A: MutableCollection, A: RangeReplaceableCollection
- state: The list state.
- action: The list actions.
Enhances an IdentifiedArray
reducer with list actions.
public func list<Element, Id: Hashable>(
state: WritableKeyPath<State, IdentifiedArray<Id, Element>>,
action: CasePath<Action, ListAction>
) -> Reducer
- state: The list state.
- action: The list actions.
Enhances an optional IdentifiedArray
reducer with list actions.
public func list<Element, Id: Hashable>(
state: WritableKeyPath<State, IdentifiedArray<Id, Element>?>,
action: CasePath<Action, ListAction>
) -> Reducer
- state: The list state.
- action: The list actions.
Enhances a reducer with edit mode capabilities.
public func editMode(
state: WritableKeyPath<State, EditMode>,
action: CasePath<Action, EditModeAction>
) -> Reducer
- state: The edit mode state.
- action: The edit mode action.
Enhances a reducer with loadable picker actions.
public func loadablePicker<Element, Id: Hashable, Failure: Error>(
state: WritableKeyPath<State, LoadablePickerState<Element, Id, Failure>>,
action: CasePath<Action, LoadablePickerAction<Element, Id, Failure>>
) -> Reducer
When using this overload, the caller is responsible for implementing / calling the loadable(.load)
action with the appropriate request type.
However it handles setting the state appropriately on the loadable value.
- state: The loadable picker state.
- action: The loadable picker action.
Enhances a reducer with loadable picker actions.
public func loadablePicker<Element, Id: Hashable, Failure: Error>(
state: WritableKeyPath<State, LoadablePickerState<Element, Id, Failure>>,
action: CasePath<Action, LoadablePickerAction<Element, Id, Failure>>,
environment: @escaping (Environment) -> LoadablePickerEnvironment<
Element, EmptyLoadRequest, Failure
>
) -> Reducer
- state: The loadable picker state.
- action: The loadable picker action.
- environment: The loadable picker environment.
Enhances a reducer with forEach
actions for use in a LoadableForEachStore
view.
public func forEach<
Element,
ElementAction,
ElementEnvironment,
Id: Hashable,
Failure: Error
>(
elementReducer: Reducer<Element, ElementAction, ElementEnvironment>,
environment: @escaping (Environment) -> ElementEnvironment
) -> Reducer
where
State == LoadableForEachState<Element, Id, Failure>,
Action == LoadableForEachAction<Element, ElementAction, Id, Failure>
- elementReducer: The reducer for the element.
- environment: The environment for the element.
Enhances a reducer with forEach
actions for use in a LoadableForEachStore
view, when the element environment is Void
.
public func forEach<
Element,
ElementAction,
Id: Hashable,
Failure: Error
>(
elementReducer: Reducer<Element, ElementAction, Void>
) -> Reducer
where
State == LoadableForEachState<Element, Id, Failure>,
Action == LoadableForEachAction<Element, ElementAction, Id, Failure>
- elementReducer: The reducer for the element.
Enhances a reducer with minimal functionality for use in a LoadableForEachStore
view.
public func loadableForEachStore<
Element,
ElementAction,
Id: Hashable,
Failure: Error
>(
state: WritableKeyPath<State, LoadableForEachState<Element, Id, Failure>>,
action: CasePath<Action, LoadableForEachAction<Element, ElementAction, Id, Failure>>
) -> Reducer
When using this overload, the caller must still implement the forEach
and loadable(.load)
actions appropriately. It
will however provide the appropriate state changes on the loadable
.
- state: The loadable for each state.
- action: The loadable for each action.
Enhances a reducer with all functionality, except the forEach
actions for use in a LoadableForEachStore
view.
public func loadableForEachStore<
Element,
ElementAction,
Id: Hashable,
Failure: Error
>(
id: KeyPath<Element, Id>,
state: WritableKeyPath<State, LoadableForEachState<Element, Id, Failure>>,
action: CasePath<Action, LoadableForEachAction<Element, ElementAction, Id, Failure>>,
environment: @escaping (Environment) -> LoadableForEachEnvironment<
Element, Id, EmptyLoadRequest, Failure
>
) -> Reducer
When using this overload, the caller must still implement the forEach
actions.
- state: The loadable for each state.
- action: The loadable for each action.
- environment: The loadable for each environment.
Enhances a reducer with all functionality for use in a LoadableForEachStore
view.
public func loadableForEachStore<
Element,
ElementAction,
ElementEnvironment,
Id: Hashable,
Failure: Error
>(
id: KeyPath<Element, Id>,
state: WritableKeyPath<State, LoadableForEachState<Element, Id, Failure>>,
action: CasePath<Action, LoadableForEachAction<Element, ElementAction, Id, Failure>>,
environment: @escaping (Environment) -> LoadableForEachEnvironment<
Element, Id, EmptyLoadRequest, Failure
>,
forEach elementReducer: Reducer<Element, ElementAction, ElementEnvironment>,
elementEnvironment: @escaping (Environment) -> ElementEnvironment
) -> Reducer
- state: The loadable for each state.
- action: The loadable for each action.
- environment: The loadable for each environment.
- elementReducer: The reducer for an individual element.
- elementEnvironment: The environment for an individual element.
Enhances a reducer with all functionality for use in a LoadableForEachStore
view, when the element environment is Void
.
public func loadableForEachStore<
Element,
ElementAction,
Id: Hashable,
Failure: Error
>(
id: KeyPath<Element, Id>,
state: WritableKeyPath<State, LoadableForEachState<Element, Id, Failure>>,
action: CasePath<Action, LoadableForEachAction<Element, ElementAction, Id, Failure>>,
environment: @escaping (Environment) -> LoadableForEachEnvironment<
Element, Id, EmptyLoadRequest, Failure
>,
forEach elementReducer: Reducer<Element, ElementAction, Void>
) -> Reducer
- state: The loadable for each state.
- action: The loadable for each action.
- environment: The loadable for each environment.
- elementReducer: The reducer for an individual element.
Enhances a reducer with all functionality for use in a LoadableForEachStore
view, when the element is Identifiable
.
public func loadableForEachStore<
Element: Identifiable,
ElementAction,
ElementEnvironment,
Failure: Error
>(
state: WritableKeyPath<State, LoadableForEachStateFor<Element, Failure>>,
action: CasePath<Action, LoadableForEachStoreActionFor<Element, ElementAction, Failure>>,
environment: @escaping (Environment) -> LoadableForEachEnvironmentFor<Element, Failure>,
forEach elementReducer: Reducer<Element, ElementAction, ElementEnvironment>,
elementEnvironment: @escaping (Environment) -> ElementEnvironment
) -> Reducer
- state: The loadable for each state.
- action: The loadable for each action.
- environment: The loadable for each environment.
- elementReducer: The reducer for an individual element.
- elementEnvironment: The environment for an individual element.
Enhances a reducer with all functionality for use in a LoadableForEachStore
view, when the element is Identifiable
and the
element environment is Void
.
public func loadableForEachStore<
Element: Identifiable,
ElementAction,
Failure: Error
>(
state: WritableKeyPath<State, LoadableForEachStateFor<Element, Failure>>,
action: CasePath<Action, LoadableForEachStoreActionFor<Element, ElementAction, Failure>>,
environment: @escaping (Environment) -> LoadableForEachEnvironmentFor<Element, Failure>,
forEach elementReducer: Reducer<Element, ElementAction, Void>
) -> Reducer
- state: The loadable for each state.
- action: The loadable for each action.
- environment: The loadable for each environment.
- elementReducer: The reducer for an individual element.
Enhances a reducer with all functionality, except the forEach
actions for use in a LoadableForEachStore
view, when the
element is Identifiable
.
public func loadableForEachStore<
Element: Identifiable,
ElementAction,
Failure: Error
>(
state: WritableKeyPath<State, LoadableForEachStateFor<Element, Failure>>,
action: CasePath<Action, LoadableForEachStoreActionFor<Element, ElementAction, Failure>>,
environment: @escaping (Environment) -> LoadableForEachEnvironmentFor<Element, Failure>
) -> Reducer
When using this overload, the caller must still implement the forEach
actions.
- state: The loadable for each state.
- action: The loadable for each action.
- environment: The loadable for each environment.
Enhances a reducer with loadable actions.
public func loadable<Value, Failure>(
state: WritableKeyPath<State, Loadable<Value, Failure>>,
action: CasePath<Action, LoadableAction<Value, Failure>>
) -> Reducer
When using this overload the caller still needs to implement / override the load
, however it handles
setting the state appropriately on the loadable.
- state: The key path to a loadable item.
- action: The case path to the loadable actions.
Enhances a reducer with all the loadable actions when the environment's LoadRequest
type is equal to EmptyLoadRequest
.
public func loadable<E>(
state: WritableKeyPath<State, Loadable<E.LoadedValue, E.Failure>>,
action: CasePath<Action, LoadableAction<E.LoadedValue, E.Failure>>,
environment: @escaping (Environment) -> E
) -> Reducer
where
E: LoadableEnvironmentRepresentable,
E.LoadRequest == EmptyLoadRequest
- state: The key path to a loadable item.
- action: The case path to the loadable actions.
- environment: The loadable environment.
Enhances a reducer with loadable list actions.
public func loadableList<Element, Failure>(
state: WritableKeyPath<State, LoadableListState<Element, Failure>>,
action: CasePath<Action, LoadableListAction<Element, Failure>>
) -> Reducer
When using this overload the caller still needs to implement / override the loadable(.load)
, however it handles
setting the state appropriately on the loadable.
- state: The loadable list state.
- action: The loadable list actions.
Enhances a reducer with loadable list actions.
public func loadableList<Element, Failure>(
state: WritableKeyPath<State, LoadableListStateFor<Element, Failure>>,
action: CasePath<Action, LoadableListActionFor<Element, Failure>>,
environment: @escaping (Environment) -> LoadableListEnvironmentFor<Element, Failure>
) -> Reducer where Failure: Equatable, Failure: Error
- state: The loadable list state.
- action: The loadable list actions.
- environment: The loadable list environment.
Generated at 2021-08-23T22:43:49+0000 using swift-doc 1.0.0-rc.1.
Types
- EditButton
- EditMode
- EditModeAction
- EmptyLoadRequest
- ListAction
- LoadError
- Loadable
- LoadableAction
- LoadableEnvironment
- LoadableForEachAction
- LoadableForEachEnvironment
- LoadableForEachState
- LoadableForEachStore
- LoadableList
- LoadableListAction
- LoadableListEnvironment
- LoadableListState
- LoadablePicker
- LoadablePickerAction
- LoadablePickerEnvironment
- LoadablePickerState
- LoadableView
- User
- UserAction