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.
@MainActor convenience init<State>(_ store: Store<State, ViewAction>, observe toViewState: @escaping (_ state: BindingViewStore<State>) -> ViewState, removeDuplicates isDuplicate: @escaping (_ lhs: ViewState, _ rhs: ViewState) -> Bool) where ViewAction : BindableAction, State == ViewAction.State
Initializes a structure that transforms a Store
into an observable ViewStore
in order to compute bindings from 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: BindingViewStore<State>) -> ViewState, send fromViewAction: @escaping (_ viewAction: ViewAction) -> Action, removeDuplicates isDuplicate: @escaping (_ lhs: ViewState, _ rhs: ViewState) -> Bool) where ViewAction : BindableAction, State == ViewAction.State
Initializes a structure that transforms a Store
into an observable ViewStore
in order to compute bindings from state.
@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.