You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+16-13Lines changed: 16 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -100,13 +100,12 @@ If there is no `Event`-based transition, use built-in `NoEvent` instead.
100
100
101
101
### State & Event enums with associated values
102
102
103
-
Above examples use _arrow-style routing_ which are easy to understand, but it lacks in ability to handle state & event enums with associated values. In such cases, use either of the following functions to apply _closure-style routing_:
103
+
Above examples use _arrow-style routing_ which are easy to understand, but it lacks in ability to handle **state & event enums with associated values**. In such cases, use either of the following functions to apply _closure-style routing_:
- Success/Error/Entry/Exit handlers with `order: UInt8` (more flexible than before/after handlers)
187
-
- Removable routes and handlers
188
-
- Chaining: `.State0 => .State1 => .State2`
189
+
- Success/Error handlers with `order: UInt8` (more flexible than before/after handlers)
190
+
- Removable routes and handlers using `Disposable`
191
+
-Route Chaining: `.State0 => .State1 => .State2`
189
192
- Hierarchical State Machine: [#10](https://github.com/ReactKit/SwiftState/pull/10)
190
193
191
194
## Terms
@@ -198,8 +201,8 @@ State Machine | `Machine` | State transition manager which c
198
201
Transition | `Transition` | `From-` and `to-` states represented as `.State1 => .State2`. Also, `.Any` can be used to represent _any state_.
199
202
Route | `Route` | `Transition` + `Condition`.
200
203
Condition | `Context -> Bool` | Closure for validating transition. If condition returns `false`, transition will fail and associated handlers will not be invoked.
201
-
Event Route Mapping | `(event: E?, fromState: S, userInfo: Any?) -> S?` | Another way of defining routes **using closure instead of transition arrows (`=>`)**. This is useful when state & event are enum with associated values. Return value (`S?`) means preferred-`toState`, where passing `nil` means no routes available. See [#36](https://github.com/ReactKit/SwiftState/pull/36) for more info.
202
-
State Route Mapping | `(fromState: S, userInfo: Any?) -> [S]?` | Another way of defining routes **using closure instead of transition arrows (`=>`)**. This is useful when state is enum with associated values. Return value (`[S]?`) means multiple `toState`s from single `fromState`. See [#36](https://github.com/ReactKit/SwiftState/pull/36) for more info.
204
+
Route Mapping | `(event: E?, fromState: S, userInfo: Any?) -> S?` | Another way of defining routes **using closure instead of transition arrows (`=>`)**. This is useful when state & event are enum with associated values. Return value (`S?`) means preferred-`toState`, where passing `nil` means no routes available. See [#36](https://github.com/ReactKit/SwiftState/pull/36) for more info.
205
+
State Route Mapping | `(fromState: S, userInfo: Any?) -> [S]?` | Another way of defining routes **using closure instead of transition arrows (`=>`)**. This is useful when state is enum with associated values. Return value (`[S]?`) means multiple `toState`s from single `fromState` (synonym for multiple routing e.g. `.State0 => [.State1, .State2]`). See [#36](https://github.com/ReactKit/SwiftState/pull/36) for more info.
203
206
Handler | `Context -> Void` | Transition callback invoked when state has been changed successfully.
0 commit comments