import ComposableArchitecture
The Composable Architecture (TCA, for short) is a library for building applications in a consistent and understandable way, with composition, testing, and ergonomics in mind. It can be used in SwiftUI, UIKit, and more, and on any Apple platform (iOS, macOS, tvOS, and watchOS).
protocol Reducer<State, Action>
A protocol that describes how to evolve the current state of an application to the next state, given an action, and describes what Effect
s should be executed later by the store, if any.
func forEach<DestinationState, DestinationAction>(_ state: WritableKeyPath<State, StackState<DestinationState>>, action: CaseKeyPath<Action, StackAction<DestinationState, DestinationAction>>) -> some ReducerOf<Self> where DestinationState : CaseReducerState, DestinationAction == DestinationState.StateReducer.Action
A special overload of Reducer/forEach(_:action:destination:fileID:filePath:line:column:)-9svqb
for enum reducers.
@warn_unqualified_access func forEach<DestinationState, DestinationAction, Destination>(_ toStackState: WritableKeyPath<State, StackState<DestinationState>>, action toStackAction: AnyCasePath<Action, StackAction<DestinationState, DestinationAction>>, @ReducerBuilder<DestinationState, DestinationAction> destination: () -> Destination, fileID: StaticString = #fileID, filePath: StaticString = #filePath, line: UInt = #line, column: UInt = #column) -> some Reducer<State, Action> where DestinationState == Destination.State, DestinationAction == Destination.Action, Destination : Reducer
@warn_unqualified_access func forEach<DestinationState, DestinationAction, Destination>(_ toStackState: WritableKeyPath<State, StackState<DestinationState>>, action toStackAction: CaseKeyPath<Action, StackAction<DestinationState, DestinationAction>>, @ReducerBuilder<DestinationState, DestinationAction> destination: () -> Destination, fileID: StaticString = #fileID, filePath: StaticString = #filePath, line: UInt = #line, column: UInt = #column) -> some Reducer<State, Action> where DestinationState == Destination.State, DestinationAction == Destination.Action, Destination : Reducer
Embeds a child reducer in a parent domain that works on elements of a navigation stack in parent state.
@warn_unqualified_access func forEach<ElementState, ElementAction, ID, Element>(_ toElementsState: WritableKeyPath<State, IdentifiedArray<ID, ElementState>>, action toElementAction: AnyCasePath<Action, (ID, ElementAction)>, @ReducerBuilder<ElementState, ElementAction> element: () -> Element, fileID: StaticString = #fileID, filePath: StaticString = #filePath, line: UInt = #line, column: UInt = #column) -> some Reducer<State, Action> where ElementState == Element.State, ElementAction == Element.Action, ID : Hashable, ID : Sendable, Element : Reducer
@warn_unqualified_access func forEach<ElementState, ElementAction, ID, Element>(_ toElementsState: WritableKeyPath<State, IdentifiedArray<ID, ElementState>>, action toElementAction: CaseKeyPath<Action, IdentifiedAction<ID, ElementAction>>, @ReducerBuilder<ElementState, ElementAction> element: () -> Element, fileID: StaticString = #fileID, filePath: StaticString = #filePath, line: UInt = #line, column: UInt = #column) -> some Reducer<State, Action> where ElementState == Element.State, ElementAction == Element.Action, ID : Hashable, ID : Sendable, Element : Reducer
Embeds a child reducer in a parent domain that works on elements of a collection in parent state.
@warn_unqualified_access func ifCaseLet<CaseState, CaseAction, Case>(_ toCaseState: CaseKeyPath<State, CaseState>, action toCaseAction: CaseKeyPath<Action, CaseAction>, @ReducerBuilder<CaseState, CaseAction> then case: () -> Case, fileID: StaticString = #fileID, filePath: StaticString = #filePath, line: UInt = #line, column: UInt = #column) -> _IfCaseLetReducer<Self, Case> where CaseState == Case.State, CaseAction == Case.Action, Case : Reducer, Self.Action : CasePathable, Self.State : CasePathable
Embeds a child reducer in a parent domain that works on a case of parent enum state.
@warn_unqualified_access func ifCaseLet<CaseState, CaseAction, Case>(_ toCaseState: AnyCasePath<State, CaseState>, action toCaseAction: AnyCasePath<Action, CaseAction>, @ReducerBuilder<CaseState, CaseAction> then case: () -> Case, fileID: StaticString = #fileID, filePath: StaticString = #filePath, line: UInt = #line, column: UInt = #column) -> some Reducer<State, Action> where CaseState == Case.State, CaseAction == Case.Action, Case : Reducer
func ifLet<ChildState, ChildAction>(_ state: WritableKeyPath<State, PresentationState<ChildState>>, action: CaseKeyPath<Action, PresentationAction<ChildAction>>) -> some ReducerOf<Self> where ChildState : CaseReducerState, ChildAction == ChildState.StateReducer.Action
A special overload of Reducer/ifLet(_:action:destination:fileID:filePath:line:column:)-4ub6q
for enum reducers.
@warn_unqualified_access func ifLet<DestinationState, DestinationAction, Destination>(_ toPresentationState: WritableKeyPath<State, PresentationState<DestinationState>>, action toPresentationAction: AnyCasePath<Action, PresentationAction<DestinationAction>>, @ReducerBuilder<DestinationState, DestinationAction> destination: () -> Destination, fileID: StaticString = #fileID, filePath: StaticString = #filePath, line: UInt = #line, column: UInt = #column) -> some Reducer<State, Action> where DestinationState == Destination.State, DestinationAction == Destination.Action, Destination : Reducer
@warn_unqualified_access func ifLet<DestinationState, DestinationAction, Destination>(_ toPresentationState: WritableKeyPath<State, PresentationState<DestinationState>>, action toPresentationAction: CaseKeyPath<Action, PresentationAction<DestinationAction>>, @ReducerBuilder<DestinationState, DestinationAction> destination: () -> Destination, fileID: StaticString = #fileID, filePath: StaticString = #filePath, line: UInt = #line, column: UInt = #column) -> some Reducer<State, Action> where DestinationState == Destination.State, DestinationAction == Destination.Action, Destination : Reducer
Embeds a child reducer in a parent domain that works on an optional property of parent state.
@warn_unqualified_access func ifLet<WrappedState, WrappedAction>(_ toWrappedState: WritableKeyPath<State, WrappedState?>, action toWrappedAction: AnyCasePath<Action, WrappedAction>, fileID: StaticString = #fileID, filePath: StaticString = #filePath, line: UInt = #line, column: UInt = #column) -> _IfLetReducer<Self, EmptyReducer<WrappedState, WrappedAction>> where WrappedState : _EphemeralState
@warn_unqualified_access func ifLet<DestinationState, DestinationAction>(_ toPresentationState: WritableKeyPath<State, PresentationState<DestinationState>>, action toPresentationAction: AnyCasePath<Action, PresentationAction<DestinationAction>>, fileID: StaticString = #fileID, filePath: StaticString = #filePath, line: UInt = #line, column: UInt = #column) -> some Reducer<State, Action> where DestinationState : _EphemeralState
@warn_unqualified_access func ifLet<DestinationState, DestinationAction>(_ toPresentationState: WritableKeyPath<State, PresentationState<DestinationState>>, action toPresentationAction: CaseKeyPath<Action, PresentationAction<DestinationAction>>, fileID: StaticString = #fileID, filePath: StaticString = #filePath, line: UInt = #line, column: UInt = #column) -> some Reducer<State, Action> where DestinationState : _EphemeralState
A special overload of Reducer/ifLet(_:action:destination:fileID:filePath:line:column:)-4ub6q
for alerts and confirmation dialogs that does not require a child reducer.
@warn_unqualified_access func ifLet<WrappedState, WrappedAction>(_ toWrappedState: WritableKeyPath<State, WrappedState?>, action toWrappedAction: CaseKeyPath<Action, WrappedAction>, fileID: StaticString = #fileID, filePath: StaticString = #filePath, line: UInt = #line, column: UInt = #column) -> some Reducer<State, Action> where WrappedState : _EphemeralState
A special overload of Reducer/ifLet(_:action:then:fileID:filePath:line:column:)-2r2pn
for alerts and confirmation dialogs that does not require a child reducer.
@warn_unqualified_access func ifLet<WrappedState, WrappedAction, Wrapped>(_ toWrappedState: WritableKeyPath<State, WrappedState?>, action toWrappedAction: AnyCasePath<Action, WrappedAction>, @ReducerBuilder<WrappedState, WrappedAction> then wrapped: () -> Wrapped, fileID: StaticString = #fileID, filePath: StaticString = #filePath, line: UInt = #line, column: UInt = #column) -> some Reducer<State, Action> where WrappedState == Wrapped.State, WrappedAction == Wrapped.Action, Wrapped : Reducer
func onChange<V, R>(of toValue: @escaping (State) -> V, @ReducerBuilder<Self.State, Self.Action> _ reducer: @escaping (_ oldValue: V, _ newValue: V) -> R) -> _OnChangeReducer<Self, V, R> where V : Equatable, R : Reducer, Self.Action == R.Action, Self.State == R.State
Adds a reducer to run when this reducer changes the given value in state.
func onChange<V, R>(of toValue: @escaping (State) -> V, removeDuplicates isDuplicate: @escaping (V, V) -> Bool, @ReducerBuilder<Self.State, Self.Action> _ reducer: @escaping (_ oldValue: V, _ newValue: V) -> R) -> _OnChangeReducer<Self, V, R> where R : Reducer, Self.Action == R.Action, Self.State == R.State
Adds a reducer to run when this reducer changes the given value in state.