State
A type that holds the current state of the reducer.
associatedtype State
Observing state
macro ObservableState(
) Defines and implements conformance of the Observable protocol.
A type that holds the current state of the reducer.
associatedtype State
macro ObservableState()
Defines and implements conformance of the Observable protocol.
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.
@attached(extension, conformances: Observable, ObservableState) @attached(member, names: named(_$id), named(_$observationRegistrar), named(_$willModify)) @attached(memberAttribute) macro ObservableState()
Defines and implements conformance of the Observable protocol.
@attached(member, names: named(State), named(Action), named(init), named(body), named(CaseScope), named(scope)) @attached(memberAttribute) @attached(extension, conformances: Reducer, CaseReducer) macro Reducer()
Helps implement the conformance to the Reducer
protocol for a type.
associatedtype Action
A type that holds all possible actions that cause the State
of the reducer to change and/or kick off a side Effect
that can communicate with the outside world.
struct Effect<Action>
struct Reduce<State, Action>
A type-erased reducer that invokes the given reduce
function.
associatedtype Body
A type representing the body of this reducer.
@ReducerBuilder<Self.State, Self.Action> var body: Body { get }
The content and behavior of a reducer that is composed from other reducers.
func reduce(into state: inout State, action: Action) -> Effect<Action>
Evolves the current state of the reducer to the next state.
associatedtype State = Self.State