Skip to content

Commit 80fca7e

Browse files
committed
Update Readme
1 parent 36dccf4 commit 80fca7e

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,57 @@ Swift-Rex is a modern state management library that supports both SwiftUI and UI
1818
- 🛡️ **Thread-Safe**: Actor-based architecture ensures safe concurrent access
1919
- 📡 **Event Bus**: Thread-safe event system with guaranteed sequential processing
2020

21+
## 🏗 Architecture
22+
23+
Swift-Rex uses a unidirectional data flow: **UI → Action → Middleware → Reducer → State → UI**. The EventBus provides optional cross-component messaging.
24+
25+
```mermaid
26+
flowchart LR
27+
subgraph UI
28+
V[View]
29+
end
30+
subgraph Store
31+
D[Dispatch]
32+
S[(State)]
33+
end
34+
subgraph Pipeline
35+
M[Middleware]
36+
R[Reducer]
37+
E[Effects]
38+
end
39+
V -->|"dispatch(Action)"| D
40+
D --> M
41+
M --> R
42+
R -->|"new State + Effects"| S
43+
R --> E
44+
E -->|"send(Action)"| D
45+
S -->|"subscribe"| V
46+
```
47+
48+
```mermaid
49+
flowchart TB
50+
subgraph Core
51+
Store[Store]
52+
Reducer[Reducer]
53+
Middleware[Middleware]
54+
Effect[Effect]
55+
end
56+
subgraph Types
57+
Statable[Statable]
58+
Actionable[Actionable]
59+
EventItem[EventItem]
60+
end
61+
Store --> Reducer
62+
Store --> Middleware
63+
Reducer --> Effect
64+
Reducer --> Statable
65+
Reducer --> Actionable
66+
Store -.->|"optional"| EventBus[EventBus]
67+
EventBus --> EventItem
68+
```
69+
70+
**Data flow:** User Action → Dispatch → Middleware → Reducer → (State update + Effects) → Subscribers / UI. Effects can dispatch new actions for async work.
71+
2172
## 📦 Installation
2273

2374
### Swift Package Manager

0 commit comments

Comments
 (0)