id(state:action:)
Store.swift:440This declaration is gated by at least one @_spi attribute.
@MainActor func id<ChildState, ChildAction>(state: KeyPath<State, ChildState>, action: CaseKeyPath<Action, ChildAction>) -> ScopeID<State, Action>
This declaration is gated by at least one @_spi attribute.
@MainActor func id<ChildState, ChildAction>(state: KeyPath<State, ChildState>, action: CaseKeyPath<Action, ChildAction>) -> ScopeID<State, Action>
s22ComposableArchitecture5StoreC2id5state6actionAA7ScopeIDVyxq_Gs7KeyPathCyxqd__G_AKy13CasePathsCore0K0Vyq_GAOyqd_0_GGtr0_lF
What are these?8SJYP
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.
@globalActor final actor MainActor
A singleton actor whose executor is equivalent to the main dispatch queue.
class KeyPath<Root, Value>
A key path from a specific root type to a specific resulting value type.
typealias CaseKeyPath<Root, Value> = KeyPath<Case<Root>, Case<Value>>
A key path to the associated value of an enum case.
struct ScopeID<State, Action>
@MainActor convenience init<R>(initialState: @autoclosure () -> R.State, @ReducerBuilder<State, Action> reducer: () -> R, withDependencies prepareDependencies: ((inout DependencyValues) -> Void)? = nil) where State == R.State, Action == R.Action, R : Reducer
Initializes a store from an initial state and a reducer.
@MainActor var currentState: State { get }
nonisolated var debugDescription: String { get }
@MainActor var publisher: StorePublisher<State> { get }
A publisher that emits when state changes.
@MainActor let rootStore: RootStore
@MainActor subscript<ElementState, ElementAction>(fileID fileID: _HashableStaticString, filePath filePath: _HashableStaticString, line line: UInt, column column: UInt) -> StackState<ElementState>.PathView where State == StackState<ElementState>, Action == StackAction<ElementState, ElementAction> { get set }
nonisolated static func == (lhs: Store, rhs: Store) -> Bool
nonisolated func hash(into hasher: inout Hasher)
@MainActor func ifLet<Wrapped>(then unwrap: @escaping (_ store: Store<Wrapped, Action>) -> Void, else: @escaping () -> Void = {}) -> any Cancellable where State == Wrapped?
Calls one of two closures depending on whether a store’s optional state is nil
or not, and whenever this condition changes for as long as the cancellable lives.
@MainActor func scope<ChildState, ChildAction>(id: ScopeID<State, Action>?, state: ToState<State, ChildState>, action fromChildAction: @escaping (ChildAction) -> Action, isInvalid: ((State) -> Bool)?) -> Store<ChildState, ChildAction>
@MainActor func scope<ChildState, ChildAction>(state: KeyPath<State, ChildState>, action: CaseKeyPath<Action, ChildAction>) -> Store<ChildState, ChildAction>
Scopes the store to one that exposes child state and actions.
@discardableResult @MainActor func send(_ action: Action) -> StoreTask
Sends an action to the store.
@discardableResult @MainActor func send(_ action: Action, animation: Animation?) -> StoreTask
Sends an action to the store with a given animation.
@MainActor func send(_ action: Action, originatingFrom originatingAction: Action?) -> Task<Void, Never>?
@discardableResult @MainActor func send(_ action: Action, transaction: Transaction) -> StoreTask
Sends an action to the store with a given transaction.
@MainActor func withState<R>(_ body: (_ state: State) -> R) -> R
Calls the given closure with a snapshot of the current state of the store.
@MainActor func scope<ChildState, ChildAction>(state toChildState: @escaping (_ state: State) -> ChildState, action fromChildAction: @escaping (_ childAction: ChildAction) -> Action) -> Store<ChildState, ChildAction>