-
Notifications
You must be signed in to change notification settings - Fork 10
Reducer
public func pullback<GlobalState, GlobalAction, GlobalEnvironment>(
state toLocalState: CasePath<GlobalState, State>,
action toLocalAction: CasePath<GlobalAction, Action>,
breakpointOnNil: Bool = true,
_ file: StaticString = #file,
_ line: UInt = #line
) -> Reducer<GlobalState, GlobalAction, GlobalEnvironment>
@available(
*,
deprecated,
message: "'forEach' no longer takes a 'breakpointOnNil' argument"
)
public func forEach<GlobalState, GlobalAction, GlobalEnvironment, ID>(
state toLocalState: WritableKeyPath<GlobalState, IdentifiedArray<ID, State>>,
action toLocalAction: CasePath<GlobalAction, (ID, Action)>,
breakpointOnNil: Bool = true,
_ file: StaticString = #file,
_ line: UInt = #line
) -> Reducer<GlobalState, GlobalAction, GlobalEnvironment>
@available(
*,
deprecated,
message: "'forEach' no longer takes a 'breakpointOnNil' argument"
)
public func forEach<GlobalState, GlobalAction, GlobalEnvironment, Key>(
state toLocalState: WritableKeyPath<GlobalState, [Key: State]>,
action toLocalAction: CasePath<GlobalAction, (Key, Action)>,
breakpointOnNil: Bool = true,
_ file: StaticString = #file,
_ line: UInt = #line
) -> Reducer<GlobalState, GlobalAction, GlobalEnvironment>
Transforms a reducer that works on local state, action, and environment into one that works on
global state, action and environment when the local environment is some GlobalEnvironment
.
It accomplishes this by providing 2 transformations to the method:
public func pullback<GlobalState, GlobalAction, GlobalEnvironment>(
state toLocalState: WritableKeyPath<GlobalState, State>,
action toLocalAction: CasePath<GlobalAction, Action>
) -> Reducer<GlobalState, GlobalAction, GlobalEnvironment>
-
A writable key path that can get/set a piece of local state from the global state.
-
A case path that can extract/embed a local action into a global action.
Because the environment is GlobalEnvironment
, its lifecycle is automatically managed by
the library.
For more information about this reducer, see the discussion about the equivalent function
using unbounded environments in swift-composable-architecture
.
- toLocalState: A key path that can get/set
State
insideGlobalState
. - toLocalAction: A case path that can extract/embed
Action
fromGlobalAction
.
A reducer that works on GlobalState
, GlobalAction
, GlobalEnvironment
.
Transforms a reducer that works on local state, action, and environment into one that works on
global state, action and environmentwhen the local environment is a GlobalEnvironment
.
public func pullback<GlobalState, GlobalAction, GlobalEnvironment>(
state toLocalState: CasePath<GlobalState, State>,
action toLocalAction: CasePath<GlobalAction, Action>,
_ file: StaticString = #file,
_ line: UInt = #line
) -> Reducer<GlobalState, GlobalAction, GlobalEnvironment>
It accomplishes this by providing 2 transformations to the method:
-
A case path that can extract/embed a piece of local state from the global state, which is typically an enum.
-
A case path that can extract/embed a local action into a global action.
Because the environment is GlobalEnvironment
, its lifecycle is automatically managed by
the library.
For more information about this reducer, see the discussion about the equivalent function using
unbounded environments in swift-composable-architecture
.
- toLocalState: A case path that can extract/embed
State
fromGlobalState
. - toLocalAction: A case path that can extract/embed
Action
fromGlobalAction
.
A reducer that works on GlobalState
, GlobalAction
, GlobalEnvironment
.
A version of pullback(state:action)
that transforms a reducer that works on
an element into one that works on an identified array of elements, when the local environment
is some GlobalEnvironment
.
public func forEach<GlobalState, GlobalAction, GlobalEnvironment, ID>(
state toLocalState: WritableKeyPath<GlobalState, IdentifiedArray<ID, State>>,
action toLocalAction: CasePath<GlobalAction, (ID, Action)>,
_ file: StaticString = #file,
_ line: UInt = #line
) -> Reducer<GlobalState, GlobalAction, GlobalEnvironment>
For more information about this reducer, see the discussion about the equivalent function
using unbounded environments in swift-composable-architecture
.
- toLocalState: A key path that can get/set a collection of
State
elements insideGlobalState
. - toLocalAction: A case path that can extract/embed
(Collection.Index, Action)
fromGlobalAction
. - breakpointOnNil: Raises
SIGTRAP
signal when an action is sent to the reducer but the identified array does not contain an element with the action's identifier. This is generally considered a logic error, as a child reducer cannot process a child action for unavailable child state.
A reducer that works on GlobalState
, GlobalAction
, GlobalEnvironment
.
A version of pullback(state:action:environment:)
that transforms a reducer that works on
an element into one that works on a dictionary of element values, when the local environment
is some GlobalEnvironment
.
public func forEach<GlobalState, GlobalAction, GlobalEnvironment, Key>(
state toLocalState: WritableKeyPath<GlobalState, [Key: State]>,
action toLocalAction: CasePath<GlobalAction, (Key, Action)>,
_ file: StaticString = #file,
_ line: UInt = #line
) -> Reducer<GlobalState, GlobalAction, GlobalEnvironment>
For more information about this reducer, see the discussion about the equivalent function
using unbounded environments in swift-composable-architecture
.
- toLocalState: A key path that can get/set a dictionary of
State
values insideGlobalState
. - toLocalAction: A case path that can extract/embed
(Key, Action)
fromGlobalAction
. - breakpointOnNil: Raises
SIGTRAP
signal when an action is sent to the reducer but the identified array does not contain an element with the action's identifier. This is generally considered a logic error, as a child reducer cannot process a child action for unavailable child state.
A reducer that works on GlobalState
, GlobalAction
, GlobalEnvironment
.
Transforms a reducer that works on local state, action, and environment into one that works on
global state, action and environment when the local environment is a subclass of
ComposableEnvironment
.
It accomplishes this by providing 2 transformations to the method:
public func pullback<GlobalState, GlobalAction, GlobalEnvironment>(
state toLocalState: WritableKeyPath<GlobalState, State>,
action toLocalAction: CasePath<GlobalAction, Action>
) -> Reducer<GlobalState, GlobalAction, GlobalEnvironment>
where GlobalEnvironment: ComposableEnvironment
-
A writable key path that can get/set a piece of local state from the global state.
-
A case path that can extract/embed a local action into a global action.
Because the environment is ComposableEnvironment
, its lifecycle is automatically managed
by the library.
For more information about this reducer, see the discussion about the equivalent function
using unbounded environments in swift-composable-architecture
.
- toLocalState: A key path that can get/set
State
insideGlobalState
. - toLocalAction: A case path that can extract/embed
Action
fromGlobalAction
.
A reducer that works on GlobalState
, GlobalAction
, GlobalEnvironment
.
Transforms a reducer that works on local state, action, and environment into one that works on
global state, action and environmentwhen the local environment is a subclass of
ComposableEnvironment
.
public func pullback<GlobalState, GlobalAction, GlobalEnvironment>(
state toLocalState: CasePath<GlobalState, State>,
action toLocalAction: CasePath<GlobalAction, Action>,
_ file: StaticString = #file,
_ line: UInt = #line
) -> Reducer<GlobalState, GlobalAction, GlobalEnvironment>
where GlobalEnvironment: ComposableEnvironment
It accomplishes this by providing 2 transformations to the method:
-
A case path that can extract/embed a piece of local state from the global state, which is typically an enum.
-
A case path that can extract/embed a local action into a global action.
Because the environment is ComposableEnvironment
, its lifecycle is automatically managed
by the library.
For more information about this reducer, see the discussion about the equivalent function
using unbounded environments in swift-composable-architecture
.
- toLocalState: A case path that can extract/embed
State
fromGlobalState
. - toLocalAction: A case path that can extract/embed
Action
fromGlobalAction
.
A reducer that works on GlobalState
, GlobalAction
, GlobalEnvironment
.
A version of pullback(state:action)
that transforms a reducer that works on
an element into one that works on an identified array of elements, when the local environment
is a subclass ofComposableEnvironment
.
public func forEach<GlobalState, GlobalAction, GlobalEnvironment, ID>(
state toLocalState: WritableKeyPath<GlobalState, IdentifiedArray<ID, State>>,
action toLocalAction: CasePath<GlobalAction, (ID, Action)>,
_ file: StaticString = #file,
_ line: UInt = #line
) -> Reducer<GlobalState, GlobalAction, GlobalEnvironment>
where GlobalEnvironment: ComposableEnvironment
For more information about this reducer, see the discussion about the equivalent function
using unbounded environments in swift-composable-architecture
.
- toLocalState: A key path that can get/set a collection of
State
elements insideGlobalState
. - toLocalAction: A case path that can extract/embed
(Collection.Index, Action)
fromGlobalAction
. - breakpointOnNil: Raises
SIGTRAP
signal when an action is sent to the reducer but the identified array does not contain an element with the action's identifier. This is generally considered a logic error, as a child reducer cannot process a child action for unavailable child state.
A reducer that works on GlobalState
, GlobalAction
, GlobalEnvironment
.
A version of pullback(state:action:environment:)
that transforms a reducer that works on
an element into one that works on a dictionary of element values, when the local environment
is a subclass ofComposableEnvironment
.
public func forEach<GlobalState, GlobalAction, GlobalEnvironment, Key>(
state toLocalState: WritableKeyPath<GlobalState, [Key: State]>,
action toLocalAction: CasePath<GlobalAction, (Key, Action)>,
_ file: StaticString = #file,
_ line: UInt = #line
) -> Reducer<GlobalState, GlobalAction, GlobalEnvironment>
where GlobalEnvironment: ComposableEnvironment
For more information about this reducer, see the discussion about the equivalent function
using unbounded environments in swift-composable-architecture
.
- toLocalState: A key path that can get/set a dictionary of
State
values insideGlobalState
. - toLocalAction: A case path that can extract/embed
(Key, Action)
fromGlobalAction
. - breakpointOnNil: Raises
SIGTRAP
signal when an action is sent to the reducer but the identified array does not contain an element with the action's identifier. This is generally considered a logic error, as a child reducer cannot process a child action for unavailable child state.
A reducer that works on GlobalState
, GlobalAction
, GlobalEnvironment
.
public func pullback<GlobalState, GlobalAction, GlobalEnvironment>(
state toLocalState: CasePath<GlobalState, State>,
action toLocalAction: CasePath<GlobalAction, Action>,
breakpointOnNil: Bool = true,
_ file: StaticString = #file,
_ line: UInt = #line
) -> Reducer<GlobalState, GlobalAction, GlobalEnvironment>
where GlobalEnvironment: ComposableEnvironment
@available(
*,
deprecated,
message: "'forEach' no longer takes a 'breakpointOnNil' argument"
)
public func forEach<GlobalState, GlobalAction, GlobalEnvironment, ID>(
state toLocalState: WritableKeyPath<GlobalState, IdentifiedArray<ID, State>>,
action toLocalAction: CasePath<GlobalAction, (ID, Action)>,
breakpointOnNil: Bool = true,
_ file: StaticString = #file,
_ line: UInt = #line
) -> Reducer<GlobalState, GlobalAction, GlobalEnvironment>
where GlobalEnvironment: ComposableEnvironment
@available(
*,
deprecated,
message: "'forEach' no longer takes a 'breakpointOnNil' argument"
)
public func forEach<GlobalState, GlobalAction, GlobalEnvironment, Key>(
state toLocalState: WritableKeyPath<GlobalState, [Key: State]>,
action toLocalAction: CasePath<GlobalAction, (Key, Action)>,
breakpointOnNil: Bool = true,
_ file: StaticString = #file,
_ line: UInt = #line
) -> Reducer<GlobalState, GlobalAction, GlobalEnvironment>
where GlobalEnvironment: ComposableEnvironment
Generated at 2022-08-22T21:22:01+0000 using swift-doc 1.0.0-rc.1.