_DependencyKeyWritingReducer
DependencyKeyWritingReducer.swift:151struct _DependencyKeyWritingReducer<Base> where Base : Reducer
struct _DependencyKeyWritingReducer<Base> where Base : Reducer
s22ComposableArchitecture28_DependencyKeyWritingReducerV
What are these?9V7Q2
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 dependency<Value>(_ keyPath: WritableKeyPath<DependencyValues, Value>, _ value: Value) -> _DependencyKeyWritingReducer<Base>
func reduce(into state: inout Base.State, action: Base.Action) -> Effect<Base.Action>
func transformDependency<V>(_ keyPath: WritableKeyPath<DependencyValues, V>, transform: @escaping (inout V) -> Void) -> _DependencyKeyWritingReducer<Base>
var body: Body { get }
A non-existent body.
@warn_unqualified_access func _printChanges(_ printer: _ReducerPrinter<State, Action>? = .customDump) -> _PrintChangesReducer<Self>
Enhances a reducer with debug logging of received actions and state mutations for the given printer.
@warn_unqualified_access func dependency<Value>(_ value: Value) -> _DependencyKeyWritingReducer<Self> where Value : TestDependencyKey, Value == Value.Value
Places a value in the reducer’s dependencies.
@warn_unqualified_access func dependency<Value>(_ keyPath: WritableKeyPath<DependencyValues, Value>, _ value: Value) -> _DependencyKeyWritingReducer<Self>
Sets the dependency value of the specified key path to the given value.
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
@warn_unqualified_access func ifLet<WrappedState, WrappedAction, Wrapped>(_ toWrappedState: WritableKeyPath<State, WrappedState?>, action toWrappedAction: CaseKeyPath<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
Embeds a child reducer in a parent domain that works on an optional property of parent state.
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.
@warn_unqualified_access func signpost(_ prefix: String = "", log: OSLog = OSLog(
subsystem: "co.pointfree.ComposableArchitecture",
category: "Reducer Instrumentation"
)) -> _SignpostReducer<Self>
Instruments a reducer with signposts.
@warn_unqualified_access func transformDependency<V>(_ keyPath: WritableKeyPath<DependencyValues, V>, transform: @escaping (_ dependency: inout V) -> Void) -> _DependencyKeyWritingReducer<Self>
Transform a reducer’s dependency value at the specified key path with the given function.
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.