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