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).
@dynamicMemberLookup @preconcurrency @MainActor final class ViewStore<ViewState, ViewAction>
A ViewStore
is an object that can observe state changes and send actions. They are most commonly used in views, such as SwiftUI views, UIView or UIViewController, but they can be used anywhere it makes sense to observe state or send actions.
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.
@MainActor init<State, Action>(_ store: Store<State, Action>, observe toViewState: @escaping (_ state: State) -> ViewState, send fromViewAction: @escaping (_ viewAction: ViewAction) -> Action, removeDuplicates isDuplicate: @escaping (_ lhs: ViewState, _ rhs: ViewState) -> Bool)
Initializes a view store from a store which observes changes to state.
@MainActor convenience init<State>(_ store: Store<State, ViewAction>, observe toViewState: @escaping (_ state: State) -> ViewState, removeDuplicates isDuplicate: @escaping (_ lhs: ViewState, _ rhs: ViewState) -> Bool)
Initializes a view store from a store which observes changes to state.
@MainActor convenience init<State, Action>(_ store: Store<State, Action>, observe toViewState: @escaping (_ state: State) -> ViewState, send fromViewAction: @escaping (_ viewAction: ViewAction) -> Action)
Initializes a view store from a store which observes changes to state.