How ljdongz/reducerkit works
ReducerKit is a lightweight, unidirectional state-management library for SwiftUI. A view sends an action to Store; Store invokes the feature’s Reducer, updates state, and handles the returned Effect. An asynchronous Effect can use Send to dispatch a follow-up action, returning control to Store and the reducer. The ObservableState macro supplies per-property metadata used by Store’s observable version tracking. The README also describes API-backed effects, type-safe concurrency, and testable reducers; those capabilities are represented where documented, but feature implementations beyond the sampled counter example were not inspected.
Main entry points: Store.swift Store · Reducer.swift Reducer · LegacyStore.swift Legacy Store · ObservableStateMacro.swift State Macro
Components 12
State Observation
- Observable State
Sources/ReducerKit/Observable/ObservableState.swift - State Protocol
Sources/ReducerKit/Observable/ObservableStateProtocol.swift - Property Version
Sources/ReducerKit/Observable/ObservableVersion.swift - State Macro
Sources/ReducerKitMacros/ObservableStateMacro.swift - Macro Plugin
Sources/ReducerKitMacros/ReducerKitMacrosPlugin.swift
Compatibility
- Legacy Store
Sources/ReducerKit/Legacy/LegacyStore.swift
Other components
- SwiftUI View
- API Service
Connections 17
- SwiftUI View → Store: sends action
Sources/ReducerKit/Core/Store.swift - Store → Reducer: invokes
Sources/ReducerKit/Core/Store.swift - Reducer → Effect: returns effect
Sources/ReducerKit/Core/Reducer.swift - Store → Effect: handles
Sources/ReducerKit/Core/Store.swift - Store → Send: creates
Sources/ReducerKit/Core/Store.swift - Send → Store: dispatches action
Sources/ReducerKit/Core/Store.swift - SwiftUI View → Store: reads properties
Sources/ReducerKit/Core/Store.swift - Store → State Protocol: queries metadata
Sources/ReducerKit/Core/Store.swift - Store → Property Version: tracks changes
Sources/ReducerKit/Core/Store.swift - Observable State → State Protocol: declares conformance
Sources/ReducerKit/Observable/ObservableState.swift - Observable State → State Macro: expands via
Sources/ReducerKit/Observable/ObservableState.swift - Macro Plugin → State Macro: registers
Sources/ReducerKitMacros/ReducerKitMacrosPlugin.swift - State Macro → State Protocol: generates conformance
Sources/ReducerKitMacros/ObservableStateMacro.swift - Reducer → API Service: effect may call
README.md - Legacy Store → Reducer: invokes
Sources/ReducerKit/Legacy/LegacyStore.swift - Legacy Store → Effect: handles
Sources/ReducerKit/Legacy/LegacyStore.swift - Legacy Store → Send: creates
Sources/ReducerKit/Legacy/LegacyStore.swift