state
Direct access to state in the store when State
conforms to ObservableState
.
@MainActor var state: State { get }
Direct access to state in the store when State
conforms to ObservableState
.
@MainActor var state: State { get }
s22ComposableArchitecture5StoreCA2A15ObservableStateRzrlE5statexvp
What are these?1QXWL
where State:ObservableState
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 Store<State, Action>
A store represents the runtime that powers the application. It is the object that you will pass around to views that need to interact with the application.
protocol ObservableState : Perceptible
@globalActor final actor MainActor
A singleton actor whose executor is equivalent to the main dispatch queue.
@MainActor var state: State { get set }
@MainActor var state: State { get set }
@MainActor subscript<Value>(dynamicMember keyPath: KeyPath<State, Value>) -> Value { get }
@MainActor func withState<R>(_ body: (_ state: State) -> R) -> R
Calls the given closure with a snapshot of the current state of the store.
@MainActor subscript<ChildState, ChildAction>(id id: AnyHashable?, state state: KeyPath<State, ChildState?>, action action: CaseKeyPath<Action, PresentationAction<ChildAction>>, isInViewBody isInViewBody: Bool, fileID fileID: _HashableStaticString, filePath filePath: _HashableStaticString, line line: UInt, column column: UInt) -> Store<ChildState, ChildAction>? { get set }
@MainActor func scope<ChildState, ChildAction>(state: KeyPath<State, ChildState?>, action: CaseKeyPath<Action, ChildAction>, fileID: StaticString = #fileID, filePath: StaticString = #filePath, line: UInt = #line, column: UInt = #column) -> Store<ChildState, ChildAction>?
Scopes the store to optional child state and actions.
@MainActor func scope<ElementID, ElementState, ElementAction>(state: KeyPath<State, IdentifiedArray<ElementID, ElementState>>, action: CaseKeyPath<Action, IdentifiedAction<ElementID, ElementAction>>, fileID: StaticString = #fileID, filePath: StaticString = #filePath, line: UInt = #line, column: UInt = #column) -> some RandomAccessCollection<Store<ElementState, ElementAction>> where ElementID : Hashable, ElementID : Sendable
Scopes the store of an identified collection to a collection of stores.